1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
--- 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);
}
}
|