The following reply was made to PR ports/135860; it has been noted by GNATS.

From: "Daniel M. Eischen" <eisc...@vigrid.com>
To: bug-follo...@freebsd.org
Cc: u...@spoerlein.net, me...@cox.net
Subject: Re: ports/135860: [PATCH] x11/kdebase3: Unbreak on -CURRENT
Date: Sun, 05 Jul 2009 22:28:45 -0400

 This is a multi-part message in MIME format.
 --------------000209070400030200080102
 Content-Type: text/plain; charset=ISO-8859-1; format=flowed
 Content-Transfer-Encoding: 7bit
 
 This patch seems to work for me on -current.  Note that some of the constants
 have changed names under libusb20.
 
 -- 
 DE
 
 --------------000209070400030200080102
 Content-Type: text/plain;
  name="kdebase3.patch"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline;
  filename="kdebase3.patch"
 
 Index: Makefile
 ===================================================================
 RCS file: /opt/FreeBSD/cvs/ports/x11/kdebase3/Makefile,v
 retrieving revision 1.213
 diff -u -r1.213 Makefile
 --- Makefile   9 Mar 2009 17:15:42 -0000       1.213
 +++ Makefile   6 Jul 2009 05:19:34 -0000
 @@ -60,6 +60,8 @@
  
  .if ${OSVERSION} < 800069
  LIB_DEPENDS+= usb-0.1:${PORTSDIR}/devel/libusb
 +.else
 +EXTRA_PATCHES+= ${FILESDIR}/extrapatch-libusb20
  .endif
  
  .if !defined(WITHOUT_ARTSWRAPPER)
 @@ -71,7 +73,7 @@
  .endif
  
  .if !defined(WITHOUT_HAL)
 -EXTRA_PATCHES=        
${FILESDIR}/extrapatch-kioslave_media_mediamanager-halbackend.cpp \
 +EXTRA_PATCHES+=       
${FILESDIR}/extrapatch-kioslave_media_mediamanager-halbackend.cpp \
                ${FILESDIR}/extrapatch-kioslave_media_mediamanager-halbackend.h
  LIB_DEPENDS+= dbus-qt-1.1:${PORTSDIR}/devel/dbus-qt3 \
                hal.1:${PORTSDIR}/sysutils/hal
 Index: files/extrapatch-libusb20
 ===================================================================
 RCS file: files/extrapatch-libusb20
 diff -N files/extrapatch-libusb20
 --- /dev/null  1 Jan 1970 00:00:00 -0000
 +++ files/extrapatch-libusb20  6 Jul 2009 15:52:27 -0000
 @@ -0,0 +1,169 @@
 +--- kcontrol/usbview/usbdevices.h.orig        2006-07-22 10:15:22.000000000 
+0200
 ++++ kcontrol/usbview/usbdevices.h     2009-06-20 13:19:42.000000000 +0200
 +@@ -17,7 +17,9 @@
 + #include <qptrlist.h>
 + 
 + #ifdef Q_OS_FREEBSD
 +-#include <dev/usb/usb.h>
 ++#include <libusb20.h>
 ++#include <dev/usb/usb_ioctl.h>
 ++/*#include <dev/usb/usb_revision.h>*/
 + #endif
 + 
 + class USBDB;
 +@@ -66,7 +68,7 @@
 +   unsigned int _vendorID, _prodID, _revMajor, _revMinor;
 + 
 + #ifdef Q_OS_FREEBSD
 +-  void collectData( int fd, int level, usb_device_info &di, int parent );
 ++  void collectData(struct libusb20_backend *, struct libusb20_device *);
 +   QStringList _devnodes;
 + #endif
 + };
 +--- kcontrol/usbview/usbdevices.cpp.orig      2006-07-22 04:15:22.000000000 
-0400
 ++++ kcontrol/usbview/usbdevices.cpp   2009-07-06 11:47:28.000000000 -0400
 +@@ -318,17 +318,25 @@
 + 
 + /*
 +  * FreeBSD support by Markus Brueffer <mar...@brueffer.de>
 ++ * libusb20 support by Hans Petter Selasky <hsela...@freebsd.org>
 +  *
 +  * Basic idea and some code fragments were taken from FreeBSD's usbdevs(8), 
 +  * originally developed for NetBSD, so this code should work with no or 
 +  * only little modification on NetBSD.
 +  */
 + 
 +-void USBDevice::collectData( int fd, int level, usb_device_info &di, int 
parent)
 ++void USBDevice::collectData(struct libusb20_backend *pbe,
 ++    struct libusb20_device *pdev)
 + {
 ++     char tempbuf[32];
 ++     struct usb_device_info di;
 ++
 ++     if (libusb20_dev_get_info(pdev, &di))
 ++             memset(&di, 0, sizeof(di));
 ++
 +      // determine data for this device
 +-     _level        = level;
 +-     _parent       = parent;
 ++     _level        = 0;
 ++     _parent       = 0;
 +      
 +      _bus          = di.udi_bus;
 +      _device       = di.udi_addr;
 +@@ -345,87 +353,49 @@
 +      _channels     = di.udi_nports;
 +      
 +      // determine the speed
 +-#if __FreeBSD_version > 490102
 +      switch (di.udi_speed) {
 +-             case USB_SPEED_LOW:  _speed = 1.5;   break;
 +-             case USB_SPEED_FULL: _speed = 12.0;  break;
 +-             case USB_SPEED_HIGH: _speed = 480.0; break;
 ++             case LIBUSB20_SPEED_LOW:  _speed = 1.5;   break;
 ++             case LIBUSB20_SPEED_FULL: _speed = 12.0;  break;
 ++             case LIBUSB20_SPEED_HIGH: _speed = 480.0; break;
 ++             case LIBUSB20_SPEED_VARIABLE: _speed = 480.0; break;
 ++             case LIBUSB20_SPEED_SUPER: _speed = 4800.0; break;
 ++             default: _speed = 480.0; break;
 +      }
 +-#else
 +-     _speed = di.udi_lowspeed ? 1.5 : 12.0;
 +-#endif
 + 
 +      // Get all attached devicenodes
 +-     for ( int i = 0; i < USB_MAX_DEVNAMES; ++i )
 +-             if ( di.udi_devnames[i][0] )
 +-                     _devnodes << di.udi_devnames[i];
 ++     for (int i = 0; i < 32; ++i) {
 ++         if (libusb20_dev_get_iface_desc(pdev, i, tempbuf, sizeof(tempbuf)) 
== 0) {
 ++             _devnodes << tempbuf;
 ++         } else {
 ++             break;
 ++         }
 ++     }
 + 
 +      // For compatibility, split the revision number
 +      sscanf( di.udi_release, "%x.%x", &_revMajor, &_revMinor );
 + 
 +-     // Cycle through the attached devices if there are any
 +-     for ( int p = 0; p < di.udi_nports; ++p ) {
 +-             // Get data for device
 +-             struct usb_device_info di2;
 +-
 +-             di2.udi_addr = di.udi_ports[p];
 +-             
 +-             if ( di2.udi_addr >= USB_MAX_DEVICES )
 +-                     continue;
 +-                     
 +-             if ( ioctl(fd, USB_DEVICEINFO, &di2) == -1 )
 +-                     continue;
 +-
 +-             // Only add the device if we didn't detect it, yet
 +-             if (!find( di2.udi_bus, di2.udi_addr ) )
 +-             {
 +-                     USBDevice *device = new USBDevice();
 +-                     device->collectData( fd, level + 1, di2, di.udi_addr );
 +-             }
 +-     }
 + }
 + 
 +-
 +-
 + bool USBDevice::parse(QString fname)
 + {
 +-     static bool showErrorMessage = true;
 +-     bool error = false;
 ++     struct libusb20_backend *pbe;
 ++     struct libusb20_device *pdev;
 ++
 +      _devices.clear();
 +      
 +-     QFile controller("/dev/usb0");
 +-     int i = 1;
 +-     while ( controller.exists() )
 +-     {
 +-             // If the devicenode exists, continue with further inspection
 +-             if ( controller.open(IO_ReadOnly) )
 +-             {
 +-                     for ( int addr = 1; addr < USB_MAX_DEVICES; ++addr ) 
 +-                     {
 +-                             struct usb_device_info di;
 +-                             
 +-                             di.udi_addr = addr;
 +-                             if ( ioctl(controller.handle(), USB_DEVICEINFO, 
&di) != -1 )
 +-                             {
 +-                                     if (!find( di.udi_bus, di.udi_addr ) )
 +-                                     {
 +-                                             USBDevice *device = new 
USBDevice();
 +-                                             device->collectData( 
controller.handle(), 0, di, 0);
 +-                                     }
 +-                             }
 +-                     }
 +-                     controller.close();
 +-             } else {
 +-                     error = true;
 +-             }
 +-             controller.setName( 
QString::fromLocal8Bit("/dev/usb%1").arg(i++) );
 +-     }
 +-     
 +-     if ( showErrorMessage && error ) {
 +-             showErrorMessage = false;
 +-             KMessageBox::error( 0, i18n("Could not open one or more USB 
controller. Make sure, you have read access to all USB controllers that should 
be listed here."));
 ++     pbe = libusb20_be_alloc_default();
 ++     if (pbe == NULL)
 ++         return (false);
 ++
 ++     pdev = NULL;
 ++
 ++     while ((pdev = libusb20_be_device_foreach(pbe, pdev))) {
 ++         USBDevice *device = new USBDevice();
 ++         device->collectData(pbe, pdev);
 +      }
 +-     
 ++
 ++     libusb20_be_free(pbe);
 ++
 +      return true;
 + }
 + #endif
 Index: files/patch-kcontrol-usbview-usbdevices.h
 ===================================================================
 RCS file: files/patch-kcontrol-usbview-usbdevices.h
 diff -N files/patch-kcontrol-usbview-usbdevices.h
 --- files/patch-kcontrol-usbview-usbdevices.h  16 Mar 2009 19:02:52 -0000      
1.1
 +++ /dev/null  1 Jan 1970 00:00:00 -0000
 @@ -1,18 +0,0 @@
 -Patch included below. FreeBSD_version is approximate.
 -
 ---- kcontrol/usbview/usbdevices.h.orig        2006-07-22 10:15:22.000000000 
+0200
 -+++ kcontrol/usbview/usbdevices.h     2009-03-15 23:24:38.000000000 +0100
 -@@ -17,8 +17,13 @@
 - #include <qptrlist.h>
 - 
 - #ifdef Q_OS_FREEBSD
 -+#include <osreldate.h>
 -+#if __FreeBSD_version >= 800069
 -+#include <legacy/dev/usb/usb.h>
 -+#else
 - #include <dev/usb/usb.h>
 - #endif
 -+#endif
 - 
 - class USBDB;
 - 
 
 --------------000209070400030200080102--
_______________________________________________
kde-freebsd mailing list
kde-freebsd@kde.org
https://mail.kde.org/mailman/listinfo/kde-freebsd
See also http://freebsd.kde.org/ for latest information

Reply via email to