[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdebase/kcontrol/usbview
From:       Helge Deller <deller () kde ! org>
Date:       2004-06-24 22:13:12
Message-ID: 20040624221312.F007298E9 () office ! kde ! org
[Download RAW message or body]

CVS commit by deller: 

usbviewer doesn't work any longer with SUSE 9.1 2.6 kernels.
This is a work-around (you might even call it a hack :-) until kcmusb has been cleanly ported to sysfs.


  M +2 -1      kcmusb.cpp   1.17
  M +5 -1      usbdevices.cpp   1.9
  M +1 -1      usbdevices.h   1.5


--- kdebase/kcontrol/usbview/kcmusb.cpp  #1.16:1.17
@@ -89,5 +89,6 @@ void USBViewer::refresh()
   QIntDict<QListViewItem> new_items;
 
-  USBDevice::parse("/proc/bus/usb/devices");
+  if (!USBDevice::parse("/proc/bus/usb/devices"))
+    USBDevice::parse("/proc/bus/usb/devices_please-use-sysfs-instead");
 
   int level = 0;

--- kdebase/kcontrol/usbview/usbdevices.cpp  #1.8:1.9
@@ -165,5 +165,5 @@ QString USBDevice::dump()
 
 
-void USBDevice::parse(QString fname)
+bool USBDevice::parse(QString fname)
 {
   _devices.clear();
@@ -177,4 +177,7 @@ void USBDevice::parse(QString fname)
   char buffer[256];
   int fd = ::open(QFile::encodeName(fname), O_RDONLY);
+  if (fd<0)
+        return false;
+
   if (fd >= 0)
     {
@@ -202,4 +205,5 @@ void USBDevice::parse(QString fname)
       start = end+1;
     }
+  return true;
 }
 

--- kdebase/kcontrol/usbview/usbdevices.h  #1.4:1.5
@@ -39,5 +39,5 @@ public:
   static QPtrList<USBDevice> &devices() { return _devices; };
   static USBDevice *find(int bus, int device);
-  static void parse(QString fname);
+  static bool parse(QString fname);
 
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic