1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-26 09:46:09 +00:00
freebsd-ports/sysutils/k3b/files/patch-libk3bdevice-k3bdevicemanager.cpp
Simon Barner 274bc06447 - Fix detection of writer device if other devices than cdX and passX (e.g.
sgX) for X=0, 1, ... are reported by CAM.
- Bump port revision
- Submitted by Heiner Eichmann (maintainer)
2007-07-16 06:39:30 +00:00

95 lines
3.1 KiB
C++

--- libk3bdevice/k3bdevicemanager.cpp.orig Sat Jun 23 20:35:15 2007
+++ libk3bdevice/k3bdevicemanager.cpp Fri Jul 13 23:37:31 2007
@@ -357,7 +357,7 @@
int need_close = 0;
int skip_device = 0;
int bus, target, lun;
- QString dev1, dev2;
+ QString cddev, passdev;
if ((fd = open(XPT_DEVICE, O_RDWR)) == -1)
{
@@ -400,29 +400,22 @@
skip_device = 0;
if (need_close)
{
- QString pass = dev1;
- QString dev = "/dev/" + dev2;
- if (dev2.startsWith("pass"))
- {
- pass = dev2;
- dev = "/dev/" + dev1;
- }
#if __FreeBSD_version < 500100
- dev += "c";
+ cddev += "c";
#endif
- if (!dev1.isEmpty() && !dev2.isEmpty() && dev.startsWith("/dev/cd"))
+ if (!cddev.isEmpty() && !passdev.isEmpty())
{
- Device* device = new Device(dev.latin1());
+ Device* device = new Device(cddev.latin1());
device->m_bus = bus;
device->m_target = target;
device->m_lun = lun;
- device->m_passDevice = "/dev/" + pass;
- k3bDebug() << "(BSDDeviceScan) add device " << dev << ":" << bus << ":" << target << ":" << lun << endl;
+ device->m_passDevice = passdev;
+ k3bDebug() << "(BSDDeviceScan) add device " << cddev << ":" << bus << ":" << target << ":" << lun << " (" << passdev << ")" << endl;
addDevice(device);
}
need_close = 0;
- dev1="";
- dev2="";
+ cddev="";
+ passdev="";
}
bus = dev_result->path_id;
target = dev_result->target_id;
@@ -438,10 +431,11 @@
if (skip_device != 0)
break;
- if (need_close > 1)
- dev1 = periph_result->periph_name + QString::number(periph_result->unit_number);
- else
- dev2 = periph_result->periph_name + QString::number(periph_result->unit_number);
+ k3bDebug() << "(BSDDeviceScan) periph: " << periph_result->periph_name << periph_result->unit_number << endl;
+ if (QString("cd") == periph_result->periph_name)
+ cddev = "/dev/cd" + QString::number(periph_result->unit_number);
+ else if (QString("pass") == periph_result->periph_name)
+ passdev = "/dev/pass" + QString::number(periph_result->unit_number);
need_close++;
break;
@@ -459,24 +453,17 @@
if (need_close)
{
- QString pass = dev1;
- QString dev = "/dev/" + dev2;
- if (dev2.startsWith("pass"))
- {
- pass = dev2;
- dev = "/dev/" + dev1;
- }
#if __FreeBSD_version < 500100
- dev += "c";
+ cddev += "c";
#endif
- if (!dev1.isEmpty() && !dev2.isEmpty() && dev.startsWith("/dev/cd"))
+ if (!cddev.isEmpty() && !passdev.isEmpty())
{
- Device* device = new Device(dev.latin1());
+ Device* device = new Device(cddev.latin1());
device->m_bus = bus;
device->m_target = target;
device->m_lun = lun;
- device->m_passDevice = "/dev/" + pass;
- k3bDebug() << "(BSDDeviceScan) add device " << dev << ":" << bus << ":" << target << ":" << lun << endl;
+ device->m_passDevice = passdev;
+ k3bDebug() << "(BSDDeviceScan) add device " << cddev << ":" << bus << ":" << target << ":" << lun << " (" << passdev << ")" << endl;
addDevice(device);
}
}