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
|
$NetBSD: patch-gd,v 1.3 2005/11/08 18:25:44 joerg Exp $
--- kcontrol/usbview/usbdevices.cpp.orig 2005-05-24 00:13:32.000000000 +1200
+++ kcontrol/usbview/usbdevices.cpp
@@ -24,7 +24,7 @@
#include "usbdb.h"
#include "usbdevices.h"
-#ifdef Q_OS_FREEBSD
+#if defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD)
#include <sys/ioctl.h>
#include <sys/param.h>
#endif
@@ -134,7 +134,7 @@ QString USBDevice::dump()
if (!prname.isEmpty())
pr += "<td>(" + prname +")</td>";
r += i18n("<tr><td><i>Protocol</i></td>%1</tr>").arg(pr);
-#ifndef Q_OS_FREEBSD
+#if !(defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD))
r += i18n("<tr><td><i>USB Version</i></td><td>%1.%2</td></tr>")
.arg(_verMajor,0,16)
.arg(QString::number(_verMinor,16).prepend('0').right(2));
@@ -158,7 +158,7 @@ QString USBDevice::dump()
r += i18n("<tr><td><i>Speed</i></td><td>%1 Mbit/s</td></tr>").arg(_speed);
r += i18n("<tr><td><i>Channels</i></td><td>%1</td></tr>").arg(_channels);
-#ifdef Q_OS_FREEBSD
+#if defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD)
if ( _power )
r += i18n("<tr><td><i>Power Consumption</i></td><td>%1 mA</td></tr>").arg(_power);
else
@@ -186,7 +186,7 @@ QString USBDevice::dump()
}
-#ifndef Q_OS_FREEBSD
+#if !(defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD))
bool USBDevice::parse(QString fname)
{
_devices.clear();
@@ -261,7 +261,7 @@ void USBDevice::collectData( int fd, int
_channels = di.udi_nports;
// determine the speed
-#if __FreeBSD_version > 490102
+#if defined(__DragonFly__) || (defined(Q_OS_FREEBSD) && __FreeBSD_version > 490102) || defined(Q_OS_NETBSD)
switch (di.udi_speed) {
case USB_SPEED_LOW: _speed = 1.5; break;
case USB_SPEED_FULL: _speed = 12.0; break;
@@ -330,8 +330,10 @@ bool USBDevice::parse(QString fname)
}
}
controller.close();
+#ifndef Q_OS_NETBSD
} else {
error = true;
+#endif
}
controller.setName( QString::fromLocal8Bit("/dev/usb%1").arg(i++) );
}
|