You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
(12) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(9) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(6) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(3) |
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
(3) |
2008 |
Jan
|
Feb
(6) |
Mar
|
Apr
|
May
|
Jun
(7) |
Jul
|
Aug
(24) |
Sep
|
Oct
|
Nov
|
Dec
|
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
2011 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2012 |
Jan
(6) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Gerardo R. M. <gro...@us...> - 2012-01-26 19:13:29
|
Update of /cvsroot/javax-usb/javax-usb-ri-linux/src/com/ibm/jusb/os/linux In directory vz-cvs-3.sog:/tmp/cvs-serv32409/src/com/ibm/jusb/os/linux Modified Files: Version.java Log Message: change version and copyright year Index: Version.java =================================================================== RCS file: /cvsroot/javax-usb/javax-usb-ri-linux/src/com/ibm/jusb/os/linux/Version.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Version.java 3 Jun 2008 19:51:20 -0000 1.17 --- Version.java 26 Jan 2012 19:13:27 -0000 1.18 *************** *** 2,6 **** /** ! * Copyright (c) 1999 - 2001, International Business Machines Corporation. * All Rights Reserved. * --- 2,6 ---- /** ! * Copyright (c) 1999 - 2001,2008 International Business Machines Corporation. * All Rights Reserved. * *************** *** 25,36 **** public static final String LINUX_API_VERSION = "1.0.0"; ! public static final String LINUX_IMP_VERSION = "1.0.3-CVS"; public static final String LINUX_IMP_DESCRIPTION = "JSR80 : javax.usb" +"\n" ! +"\n"+"Implementation for the Linux kernel (2.4/2.6).\n" +"\n" +"\n"+"*" ! +"\n"+"* Copyright (c) 1999 - 2001, International Business Machines Corporation." +"\n"+"* All Rights Reserved." +"\n"+"*" --- 25,36 ---- public static final String LINUX_API_VERSION = "1.0.0"; ! public static final String LINUX_IMP_VERSION = "1.0.3"; public static final String LINUX_IMP_DESCRIPTION = "JSR80 : javax.usb" +"\n" ! +"\n"+"Implementation for the Linux kernel (2.4/2.6/3.0).\n" +"\n" +"\n"+"*" ! +"\n"+"* Copyright (c) 1999 - 2001,2008 International Business Machines Corporation." +"\n"+"* All Rights Reserved." +"\n"+"*" |
From: Gerardo R. M. <gro...@us...> - 2012-01-26 18:48:32
|
Update of /cvsroot/javax-usb/javax-usb-ri-linux In directory vz-cvs-3.sog:/tmp/cvs-serv28603 Modified Files: javax-usb-ri-linux.spec Log Message: Update version to 1.0.3 Index: javax-usb-ri-linux.spec =================================================================== RCS file: /cvsroot/javax-usb/javax-usb-ri-linux/javax-usb-ri-linux.spec,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** javax-usb-ri-linux.spec 19 Dec 2005 19:23:00 -0000 1.6 --- javax-usb-ri-linux.spec 26 Jan 2012 18:48:30 -0000 1.7 *************** *** 1,7 **** Summary: javax.usb Linux Implementation Name: javax-usb-ri-linux ! Version: 1.0.1 Release: 1 - Copyright: (c)Copyright International Business Machines Corporation 2001. All rights reserved. Group: System Environment/Libraries %description --- 1,6 ---- Summary: javax.usb Linux Implementation Name: javax-usb-ri-linux ! Version: 1.0.3 Release: 1 Group: System Environment/Libraries %description |
From: Gerardo R. M. <gro...@us...> - 2012-01-26 18:47:25
|
Update of /cvsroot/javax-usb/javax-usb-ri-linux/jni In directory vz-cvs-3.sog:/tmp/cvs-serv28505/jni Modified Files: JavaxUsbKernel.c Log Message: Add verification when parsing linux kernel version string Index: JavaxUsbKernel.c =================================================================== RCS file: /cvsroot/javax-usb/javax-usb-ri-linux/jni/JavaxUsbKernel.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** JavaxUsbKernel.c 3 Jun 2008 19:35:20 -0000 1.6 --- JavaxUsbKernel.c 26 Jan 2012 18:47:23 -0000 1.7 *************** *** 34,43 **** for (i=0; i<3; i++) { ! errno = 0; ! if (!(num[i] = strtol(p, &p, 0))) { ! log(LOG_ERROR, "Could not parse release string %s : %s", name.release, strerror(errno)); ! break; ! } else { ! p++; } } --- 34,44 ---- for (i=0; i<3; i++) { ! errno = 0; ! if (((int)*p < '0') || ((int)*p > '9')) { ! log(LOG_ERROR, "Could not parse release string %s : %s", name.release, strerror(errno)); ! break; ! } else { ! num[i] = strtol(p, &p,0); ! p++; } } |
From: Gerardo R. M. <gro...@us...> - 2012-01-26 18:42:10
|
Update of /cvsroot/javax-usb/javax-usb-ri In directory vz-cvs-3.sog:/tmp/cvs-serv28217 Modified Files: javax-usb-ri.spec Log Message: Update version to 1.0.2 and remove the copyright statement Index: javax-usb-ri.spec =================================================================== RCS file: /cvsroot/javax-usb/javax-usb-ri/javax-usb-ri.spec,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** javax-usb-ri.spec 19 Dec 2005 19:22:50 -0000 1.3 --- javax-usb-ri.spec 26 Jan 2012 18:42:07 -0000 1.4 *************** *** 1,7 **** Summary: javax.usb Common Reference Implementation Name: javax-usb-ri ! Version: 1.0.1 Release: 1 - Copyright: (c)Copyright International Business Machines Corporation 2001. All rights reserved. Group: System Environment/Libraries %description --- 1,6 ---- Summary: javax.usb Common Reference Implementation Name: javax-usb-ri ! Version: 1.0.2 Release: 1 Group: System Environment/Libraries %description |
From: Gerardo R. M. <gro...@us...> - 2012-01-26 18:39:28
|
Update of /cvsroot/javax-usb/javax-usb In directory vz-cvs-3.sog:/tmp/cvs-serv28063 Modified Files: javax-usb.spec Log Message: Removing license statement Index: javax-usb.spec =================================================================== RCS file: /cvsroot/javax-usb/javax-usb/javax-usb.spec,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** javax-usb.spec 26 Jan 2012 18:35:28 -0000 1.5 --- javax-usb.spec 26 Jan 2012 18:39:26 -0000 1.6 *************** *** 3,7 **** Version: 1.0.2 Release: 1 - license: (c)Copyright International Business Machines Corporation 2001,2008. All rights reserved. Group: System Environment/Libraries %description --- 3,6 ---- |
From: Gerardo R. M. <gro...@us...> - 2012-01-26 18:35:30
|
Update of /cvsroot/javax-usb/javax-usb In directory vz-cvs-3.sog:/tmp/cvs-serv27846 Modified Files: javax-usb.spec Log Message: upload version in spec file to 1.0.2 Index: javax-usb.spec =================================================================== RCS file: /cvsroot/javax-usb/javax-usb/javax-usb.spec,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** javax-usb.spec 19 Dec 2005 19:22:38 -0000 1.4 --- javax-usb.spec 26 Jan 2012 18:35:28 -0000 1.5 *************** *** 1,7 **** Summary: javax.usb API Name: javax-usb ! Version: 1.0.1 Release: 1 ! Copyright: (c)Copyright International Business Machines Corporation 2001. All rights reserved. Group: System Environment/Libraries %description --- 1,7 ---- Summary: javax.usb API Name: javax-usb ! Version: 1.0.2 Release: 1 ! license: (c)Copyright International Business Machines Corporation 2001,2008. All rights reserved. Group: System Environment/Libraries %description |
From: Trygve L. <tr...@in...> - 2011-01-21 13:43:24
|
On 1/18/11 2:10 PM, Emerson wrote: > Hi, > > I’m developing an application for Android platform. In this application, > I need to perform serial communication via USB to send and receive data. > Does anyone has experience with that? FYI: this list is for commit message from the javax.usb implementation and your question is really not on topic. However, there's not a lot of traffic so no harm done :) Your question is very vague in what you really want to do. If you're going serial over USB you probably don't have to know anything about the USB stack anyway. -- Trygve |
From: Emerson <eng...@se...> - 2011-01-18 13:30:18
|
Hi, I'm developing an application for Android platform. In this application, I need to perform serial communication via USB to send and receive data. Does anyone has experience with that? Best regards, Emerson Melo |
From: Dan S. <dds...@us...> - 2009-09-25 14:18:36
|
Update of /cvsroot/javax-usb/javax-usb-ri-linux/jni In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv25535 Modified Files: JavaxUsb.h Log Message: Add debugging to show URB address Index: JavaxUsb.h =================================================================== RCS file: /cvsroot/javax-usb/javax-usb-ri-linux/jni/JavaxUsb.h,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** JavaxUsb.h 11 Feb 2008 20:22:20 -0000 1.19 --- JavaxUsb.h 25 Sep 2009 14:18:24 -0000 1.20 *************** *** 264,267 **** --- 264,268 ---- //FIXME - add device number and/or other dev info + log( LOG_URB_METADATA, "%s : URB address = %p", calling_method, urb ); log( LOG_URB_METADATA, "%s : URB endpoint = %x status = %d signal = %x", calling_method, urb->endpoint, urb->status, urb->signr ); log( LOG_URB_METADATA, "%s : URB buffer length = %d actual length = %d", calling_method, urb->buffer_length, urb->actual_length ); |
Update of /cvsroot/javax-usb/javax-usb-libusb/src/com/mcreations/usb/windows In directory sc8-pr-cvs17.sourceforge.net:/tmp/cvs-serv25963 Modified Files: JavaxUsb.java WindowsDeviceOsImp.java WindowsInterfaceOsImp.java WindowsPipeOsImp.java WindowsUsbServices.java Log Message: Added better exception throwing when libusb returns an error, as getSerialNumber was failing silently and returning bad values. Package now appears to receive connect and disconnect notices from libusb properly. Cleaned up some log messages. Rearranged some functions in a more logical order. Removed dead code Index: WindowsUsbServices.java =================================================================== RCS file: /cvsroot/javax-usb/javax-usb-libusb/src/com/mcreations/usb/windows/WindowsUsbServices.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** WindowsUsbServices.java 18 Aug 2008 21:31:07 -0000 1.5 --- WindowsUsbServices.java 28 Aug 2008 21:22:03 -0000 1.6 *************** *** 310,316 **** int updates = JavaxUsb.nativeTopologyUpdater(this, connectedDevices, disconnectedDevices); if(updates == 0) return; // if there are no changes go home early - // connectedDevices contains all new devices found - // disconnectedDevices contains all devices removed Iterator iterator = disconnectedDevices.iterator(); while(iterator.hasNext()) --- 310,317 ---- int updates = JavaxUsb.nativeTopologyUpdater(this, connectedDevices, disconnectedDevices); if(updates == 0) return; // if there are no changes go home early + // if something has changed continue on + + // disconnectedDevices contains all devices removed Iterator iterator = disconnectedDevices.iterator(); while(iterator.hasNext()) *************** *** 320,345 **** device.disconnect(); listenerImp.usbDeviceDetached(new UsbServicesEvent(this, (UsbDevice)device )); - } iterator = connectedDevices.iterator(); while(iterator.hasNext()) { UsbDeviceImp device = (UsbDeviceImp) iterator.next(); ! // fixme: setActiveConfig... is omitted to find out, whether it // is really needed in libusb implementation // setActiveConfigAndInterfaceSettings(device); - // attachUsbDeviceImp now occures in JavaUsb.java - // try - // { - // device.getParentUsbPortImp().attachUsbDeviceImp(device); - // } - // catch (IllegalArgumentException iae) - // { - // if(log.isDebugEnabled()) log.debug( "updateTopology() while attaching UsbDeviceImp "+iae ); - // // device is already attached - // continue; - // } // Let's wait a bit before each new device's event, so its driver can have some time to --- 321,335 ---- device.disconnect(); listenerImp.usbDeviceDetached(new UsbServicesEvent(this, (UsbDevice)device )); } + // connectedDevices contains all new devices found iterator = connectedDevices.iterator(); while(iterator.hasNext()) { UsbDeviceImp device = (UsbDeviceImp) iterator.next(); ! // fixme: setActiveConfig... is omitted to find out, whether it // is really needed in libusb implementation // setActiveConfigAndInterfaceSettings(device); // Let's wait a bit before each new device's event, so its driver can have some time to *************** *** 347,351 **** try { - // if(!device.isUsbHub()) if( !(device instanceof WindowsHubOsImp) ) { --- 337,340 ---- *************** *** 357,361 **** { } ! if(log.isDebugEnabled()) log.debug( "updateTopology() connected device: "+device ); listenerImp.usbDeviceAttached(new UsbServicesEvent(this, (UsbDevice) device)); --- 346,357 ---- { } ! try ! { ! if(log.isDebugEnabled()) log.debug( "updateTopology() found device: "+device.getSerialNumberString() ); ! } ! catch(Exception e) ! { ! } ! if(log.isDebugEnabled()) log.debug( "updateTopology() connecting device: "+device ); listenerImp.usbDeviceAttached(new UsbServicesEvent(this, (UsbDevice) device)); Index: WindowsPipeOsImp.java =================================================================== RCS file: /cvsroot/javax-usb/javax-usb-libusb/src/com/mcreations/usb/windows/WindowsPipeOsImp.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** WindowsPipeOsImp.java 18 Aug 2008 18:14:52 -0000 1.3 --- WindowsPipeOsImp.java 28 Aug 2008 21:22:03 -0000 1.4 *************** *** 223,227 **** int epDir = ep.getDirection(); int result = 0; ! String action = ""; // lock the access to the libusb --- 223,227 ---- int epDir = ep.getDirection(); int result = 0; ! // String action = ""; // lock the access to the libusb *************** *** 235,239 **** if (epDir == UsbConst.ENDPOINT_DIRECTION_OUT) { ! action = "bulk write"; int chunkSize = 4096; --- 235,239 ---- if (epDir == UsbConst.ENDPOINT_DIRECTION_OUT) { ! // action = "bulk write"; int chunkSize = 4096; *************** *** 254,258 **** res = Libusb.usb_bulk_write(handle,getEndpointAddress(),buf,timeout); JavaxUsb.getMutex().release(); //FIXME not sure if this is required - if (log.isDebugEnabled()) log.debug("Called bulk_write with buffer of size "+ buf.length + ", res = " + res); --- 254,257 ---- *************** *** 267,271 **** else if (epDir == UsbConst.ENDPOINT_DIRECTION_IN) { ! action = "bulk read"; JavaxUsb.getMutex().acquire(); //FIXME not sure if this is required result = Libusb.usb_bulk_read(handle,getEndpointAddress(),irp.getData(),timeout); --- 266,270 ---- else if (epDir == UsbConst.ENDPOINT_DIRECTION_IN) { ! // action = "bulk read"; JavaxUsb.getMutex().acquire(); //FIXME not sure if this is required result = Libusb.usb_bulk_read(handle,getEndpointAddress(),irp.getData(),timeout); *************** *** 277,281 **** if (epDir == UsbConst.ENDPOINT_DIRECTION_OUT) { ! action = "interrupt write"; JavaxUsb.getMutex().acquire(); //FIXME not sure if this is required result = Libusb.usb_interrupt_write(handle,getEndpointAddress(),irp.getData(),timeout); --- 276,280 ---- if (epDir == UsbConst.ENDPOINT_DIRECTION_OUT) { ! // action = "interrupt write"; JavaxUsb.getMutex().acquire(); //FIXME not sure if this is required result = Libusb.usb_interrupt_write(handle,getEndpointAddress(),irp.getData(),timeout); *************** *** 284,288 **** else if (epDir == UsbConst.ENDPOINT_DIRECTION_IN) { ! action = "interrupt read"; // don't use a mutex here because a long time may elapse before getting a response // and FIXME, not sure a mutex is required anyway for this action --- 283,287 ---- else if (epDir == UsbConst.ENDPOINT_DIRECTION_IN) { ! // action = "interrupt read"; // don't use a mutex here because a long time may elapse before getting a response // and FIXME, not sure a mutex is required anyway for this action *************** *** 294,307 **** } ! if (result < 0) ! { ! String msg = "submitIrp: Error during " + action + ", error code " + result + ": "+ Libusb.usb_strerror(); ! log.debug(msg); ! throw new UsbException(msg); ! } ! else ! { ! irp.setActualLength(result); ! } // if (log.isDebugEnabled()) --- 293,298 ---- } ! JavaxUsb.isReturnCodeError(result); // throws an exception if retval is less than 0 ! irp.setActualLength(result); // if (log.isDebugEnabled()) Index: WindowsInterfaceOsImp.java =================================================================== RCS file: /cvsroot/javax-usb/javax-usb-libusb/src/com/mcreations/usb/windows/WindowsInterfaceOsImp.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** WindowsInterfaceOsImp.java 5 Aug 2008 20:53:24 -0000 1.3 --- WindowsInterfaceOsImp.java 28 Aug 2008 21:22:03 -0000 1.4 *************** *** 188,195 **** log.debug("Setting libusb to configuration number: "+ucd.getIConfiguration()); ! Libusb.usb_set_configuration(getWindowsDeviceOsImp().getHandle(),ucd.getIConfiguration()); ! int result = Libusb.usb_claim_interface(getWindowsDeviceOsImp().getHandle(),getInterfaceNumber()); ! if (result != 0) { String msg = "Couldn't claim interface. usb error: "+ Libusb.usb_strerror(); --- 188,196 ---- log.debug("Setting libusb to configuration number: "+ucd.getIConfiguration()); ! int retval = Libusb.usb_set_configuration(getWindowsDeviceOsImp().getHandle(),ucd.getIConfiguration()); ! JavaxUsb.isReturnCodeError(retval); // throws an exception if retval is less than 0 ! retval = Libusb.usb_claim_interface(getWindowsDeviceOsImp().getHandle(),getInterfaceNumber()); ! if (retval != 0) { String msg = "Couldn't claim interface. usb error: "+ Libusb.usb_strerror(); Index: WindowsDeviceOsImp.java =================================================================== RCS file: /cvsroot/javax-usb/javax-usb-libusb/src/com/mcreations/usb/windows/WindowsDeviceOsImp.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** WindowsDeviceOsImp.java 7 Aug 2008 14:35:10 -0000 1.3 --- WindowsDeviceOsImp.java 28 Aug 2008 21:22:03 -0000 1.4 *************** *** 164,168 **** if( (cIrp.bRequest() == UsbConst.REQUEST_SET_CONFIGURATION) && (cIrp.bmRequestType() ==0) ) { ! Libusb.usb_set_configuration( getHandle(),cIrp.wValue()); return; } --- 164,169 ---- if( (cIrp.bRequest() == UsbConst.REQUEST_SET_CONFIGURATION) && (cIrp.bmRequestType() ==0) ) { ! int retval = Libusb.usb_set_configuration( getHandle(),cIrp.wValue()); ! JavaxUsb.isReturnCodeError(retval); return; } *************** *** 189,201 **** " wLength: "+UsbUtil.toHexString(cIrp.wLength())); ! int result = Libusb.usb_control_msg(handle,cIrp.bmRequestType(),cIrp.bRequest(), cIrp.wValue(), cIrp.wIndex(),data ,JavaxUsb.getIoTimeout()); ! if(result >=0) ! cIrp.setActualLength(result); ! else ! { ! String msg = "usb_control_msg: " + Libusb.usb_strerror() +" errorno: " + result; ! log.debug(msg); ! throw new UsbException(msg); ! } } finally --- 190,196 ---- " wLength: "+UsbUtil.toHexString(cIrp.wLength())); ! int retval = Libusb.usb_control_msg(handle,cIrp.bmRequestType(),cIrp.bRequest(), cIrp.wValue(), cIrp.wIndex(),data ,JavaxUsb.getIoTimeout()); ! JavaxUsb.isReturnCodeError(retval); // throws an exception if retval is less than 0 ! cIrp.setActualLength(retval); } finally *************** *** 260,264 **** try { ! Libusb.usb_get_string_simple(handle, index, buffer); } finally --- 255,260 ---- try { ! int retval = Libusb.usb_get_string_simple(handle, index, buffer); ! JavaxUsb.isReturnCodeError(retval); // throws an exception if retval is less than 0 } finally *************** *** 293,299 **** if (handle == null) { ! String msg = ! "Couldn't open device " + device.getFilename() ! + " due to error: " + Libusb.usb_strerror(); log.debug(msg); throw new UsbException(msg); --- 289,293 ---- if (handle == null) { ! String msg = "Couldn't open device " + device.getFilename() + " due to error: " + Libusb.usb_strerror(); log.debug(msg); throw new UsbException(msg); *************** *** 303,307 **** { int bufSize = 256; ! int ret; byte[] buf = new byte[bufSize]; int manu = device.getDescriptor().getIManufacturer(); --- 297,301 ---- { int bufSize = 256; ! int retval; byte[] buf = new byte[bufSize]; int manu = device.getDescriptor().getIManufacturer(); *************** *** 309,324 **** if (manu > 0) { ! ret = Libusb.usb_get_string_simple(handle, manu, buf); ! ! if (ret > 0) ! { ! log.debug( ! "Manufacturer : " + JavaxUsb.bytes2String(buf)); ! } ! else ! { ! log.debug( ! "Unable to fetch manufacturer string\r\n"); ! } } --- 303,309 ---- if (manu > 0) { ! retval = Libusb.usb_get_string_simple(handle, manu, buf); ! JavaxUsb.isReturnCodeError(retval); // throws an exception if retval is less than 0 ! log.debug("Manufacturer : <" + JavaxUsb.bytes2String(buf)+">"); } *************** *** 327,355 **** if (prod > 0) { ! ret = Libusb.usb_get_string_simple(handle, prod, buf); ! ! if (ret > 0) ! log.debug( ! "Product : " + JavaxUsb.bytes2String(buf)); ! else ! log.debug("Unable to fetch product string\r\n"); } int serial = device.getDescriptor().getISerialNumber(); - if (serial > 0) { ! ret = Libusb.usb_get_string_simple(handle, serial, buf); ! ! if (ret > 0) ! { ! log.debug( ! "Serial Number: " + JavaxUsb.bytes2String(buf)); ! } ! else ! { ! log.debug( ! "Unable to fetch serial number string\r\n"); ! } } } // end if isDebugEnabled() --- 312,326 ---- if (prod > 0) { ! retval = Libusb.usb_get_string_simple(handle, prod, buf); ! JavaxUsb.isReturnCodeError(retval); // throws an exception if retval is less than 0 ! log.debug("Product : <" + JavaxUsb.bytes2String(buf)+">"); } int serial = device.getDescriptor().getISerialNumber(); if (serial > 0) { ! retval = Libusb.usb_get_string_simple(handle, serial, buf); ! JavaxUsb.isReturnCodeError(retval); // throws an exception if retval is less than 0 ! log.debug("Serial Number: <" + JavaxUsb.bytes2String(buf)+">"); } } // end if isDebugEnabled() *************** *** 360,364 **** } } - return handle; } --- 331,334 ---- *************** *** 379,392 **** try { ! int result = Libusb.usb_close(handle); ! if (result != 0) { ! String msg = ! "Couldn't close device " + device.getFilename() ! + " due to error: " + Libusb.usb_strerror(); log.debug(msg); throw new UsbException(msg); } } finally --- 349,362 ---- try { ! int retval = Libusb.usb_close(handle); ! if (retval != 0) { ! String msg = "Couldn't close device " + device.getFilename()+ " due to error: " + Libusb.usb_strerror(); log.debug(msg); throw new UsbException(msg); } + JavaxUsb.isReturnCodeError(retval); // throws an exception if retval is less than 0 + } finally Index: JavaxUsb.java =================================================================== RCS file: /cvsroot/javax-usb/javax-usb-libusb/src/com/mcreations/usb/windows/JavaxUsb.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** JavaxUsb.java 18 Aug 2008 21:31:07 -0000 1.7 --- JavaxUsb.java 28 Aug 2008 21:22:03 -0000 1.8 *************** *** 42,45 **** --- 42,46 ---- import javax.usb.UsbDeviceDescriptor; import javax.usb.UsbException; + import javax.usb.UsbDisconnectedException; import java.io.UnsupportedEncodingException; *************** *** 394,398 **** } ! /** * Convert the error code to a UsbException. --- 395,406 ---- } ! public static void isReturnCodeError(int error) throws UsbException, UsbDisconnectedException ! { ! if( error >=0) return; ! // log.debug("isReturnCodeError() throwing an exception on "+error); ! if(error == -19) throw new UsbDisconnectedException("libusb reports device has been disconnected: "+error+", "+Libusb.usb_strerror()); ! throw errorToUsbException(error); ! } ! /** * Convert the error code to a UsbException. *************** *** 442,446 **** * @return the message associated with the specified error number */ ! static native String nativeGetErrorMessage(int error); /** --- 450,458 ---- * @return the message associated with the specified error number */ ! // static native String nativeGetErrorMessage(int error); ! static String nativeGetErrorMessage(int error) ! { ! return(Libusb.usb_strerror()); ! } /** *************** *** 460,463 **** --- 472,504 ---- // int i); + + private static void attachParentUsbPort(UsbHubImp hub, UsbDeviceImp device) + { + List ports = hub.getUsbPorts(); + Iterator iterator = ports.iterator(); + while(iterator.hasNext()) + { + UsbPortImp usbPortImp = (UsbPortImp)iterator.next(); + if(usbPortImp.isUsbDeviceAttached()) continue; + if(log.isDebugEnabled()) log.debug("attachParentUsbPort(), found empty port"); + device.setParentUsbPortImp(usbPortImp); + usbPortImp.attachUsbDeviceImp(device); + return; + } + + byte port = hub.getNumberOfPorts(); + port++; + UsbPortImp usbPortImp = hub.getUsbPortImp((byte)port); + if( usbPortImp == null) + { + log.debug("attachParentUsbPort(), WARNING resizing hub to "+port+" ports"); + hub.resize((byte)port); + usbPortImp = hub.getUsbPortImp((byte)port); + } + usbPortImp.attachUsbDeviceImp(device); + device.setParentUsbPortImp(usbPortImp); + } + + /** * Return if the compared devices are the same device. *************** *** 478,482 **** UsbDeviceDescriptor desc2 = dev2.getUsbDeviceDescriptor(); ! if( dev1.isUsbHub() != dev1.isUsbHub() ) return(false); if( dev1.getSpeed() != dev2.getSpeed() ) return(false); if( !desc1.equals(desc2) ) return(false); --- 519,523 ---- UsbDeviceDescriptor desc2 = dev2.getUsbDeviceDescriptor(); ! if( dev1.isUsbHub() != dev2.isUsbHub() ) return(false); if( dev1.getSpeed() != dev2.getSpeed() ) return(false); if( !desc1.equals(desc2) ) return(false); *************** *** 492,495 **** --- 533,541 ---- return(false); } + catch(UsbDisconnectedException ude) + { + log.debug("isUsbDevicesEqual() device no longer exists"); + return(false); + } catch (UsbException ue) { *************** *** 519,543 **** private static void checkUsbDeviceImp(UsbHubImp hub, UsbDeviceImp device, List currentDevices, List connected) { ! String meth = "checkUsbDeviceImp"; ! // byte port = (byte)p; ! ! // if(log.isDebugEnabled()) log.debug( meth +" Entered with port" + p+" our port num "+port ); ! // UsbPortImp usbPortImp = hub.getUsbPortImp((byte)port); ! // if (null == usbPortImp) ! // { ! // log.debug(meth+" WARNING resizing port"); ! // hub.resize((byte)port); ! // usbPortImp = hub.getUsbPortImp((byte)port); ! // } ! ! if(log.isDebugEnabled()) log.debug( meth+ " Hub now has " + hub.getNumberOfPorts() + " ports"); // look for this devices in the current device list, if found remove from the list // because later, the remaining items in current device list will be removed. - boolean found = false; Iterator iterator = currentDevices.iterator(); while( iterator.hasNext()) { ! if( isUsbDevicesEqual((UsbDeviceImp)iterator.next(), device)) { iterator.remove(); --- 565,578 ---- private static void checkUsbDeviceImp(UsbHubImp hub, UsbDeviceImp device, List currentDevices, List connected) { ! boolean found = false; ! String method = "checkUsbDeviceImp"; // look for this devices in the current device list, if found remove from the list // because later, the remaining items in current device list will be removed. Iterator iterator = currentDevices.iterator(); while( iterator.hasNext()) { ! UsbDeviceImp usbDeviceFromList = (UsbDeviceImp)iterator.next(); ! if( isUsbDevicesEqual(usbDeviceFromList, device)) { iterator.remove(); *************** *** 546,692 **** } ! // if the device was not found in the list, it must be new so add it to the connected list if(!found) { ! if(log.isDebugEnabled()) log.debug(meth+" adding new device"); connected.add(device); - // device.setParentUsbPortImp(usbPortImp); attachParentUsbPort(hub,device); } - - if(log.isDebugEnabled()) log.debug(meth+ " Leaving with device " + device); } - - private static void attachParentUsbPort(UsbHubImp hub, UsbDeviceImp device) - { - if(log.isDebugEnabled()) log.debug("attachParentUsbPort"); - List ports = hub.getUsbPorts(); - Iterator iterator = ports.iterator(); - while(iterator.hasNext()) - { - UsbPortImp usbPortImp = (UsbPortImp)iterator.next(); - if(usbPortImp.isUsbDeviceAttached()) continue; - if(log.isDebugEnabled()) log.debug("attachParentUsbPort(), found empty port"); - device.setParentUsbPortImp(usbPortImp); - usbPortImp.attachUsbDeviceImp(device); - return; - } - byte port = hub.getNumberOfPorts(); - log.debug("attachParentUsbPort(), no empty ports found, out of "+ port+" ports"); - port++; - UsbPortImp usbPortImp = hub.getUsbPortImp((byte)port); - if (null == usbPortImp) - { - log.debug("attachParentUsbPort(), WARNING resizing port"); - hub.resize((byte)port); - usbPortImp = hub.getUsbPortImp((byte)port); - } - device.setParentUsbPortImp(usbPortImp); - usbPortImp.attachUsbDeviceImp(device); - } ! private static void buildConfig(UsbDeviceImp usbDev,usb_config_descriptor config) { ! UsbConfigurationDescriptorImp desc = new UsbConfigurationDescriptorImp((byte) config.getBLength(), ! (byte) config.getBDescriptorType(),(short) config.getWTotalLength(), ! (byte) config.getBNumInterfaces(),(byte) config.getBConfigurationValue(), ! (byte) config.getIConfiguration(),(byte) config.getBmAttributes(), ! (byte) config.getMaxPower()); ! ! UsbConfigurationImp usbConfig = new UsbConfigurationImp(usbDev, desc); ! usbDev.addUsbConfigurationImp(usbConfig); ! ! // FIXME: since most devices only support one configuration we will use the first one as default ! // this is probably ok for devices that support more than one configuration as well ! // unless it has been somehow previously set ! if(config.getBConfigurationValue() == 1) ! { ! // log(LOG_HOTPLUG, FUNC, CLASS, "buildConfiguration","WARNING Using config " + config.getBConfigurationValue()+" as active; no checking."); ! config.setIConfiguration((byte)1); ! usbDev.setActiveUsbConfigurationNumber((byte)config.getBConfigurationValue()); ! } ! ! for (int i = 0; i < config.getBNumInterfaces(); i++) ! { ! usb_interface iface; ! iface = Libusb.usb_interface_index(config.get_interface(),i); ! ! for (int j = 0; j < iface.getNum_altsetting(); j++) ! { ! usb_interface_descriptor ifaceDesc; ! ifaceDesc = Libusb.usb_interface_descriptor_index(iface.getAltsetting(),j); ! buildInterface(usbConfig, ifaceDesc); ! } } ! } ! ! /** ! * @param usbConfig ! * @param ifaceDesc ! */ ! private static void buildInterface(UsbConfigurationImp usbConfig, usb_interface_descriptor ifaceDesc) ! { ! // log(LOG_HOTPLUG, FUNC, CLASS, "buildInterface","Entering with config " + usbConfig); ! UsbInterfaceDescriptorImp desc = new UsbInterfaceDescriptorImp((byte) ifaceDesc.getBLength(), ! (byte) ifaceDesc.getBDescriptorType(),(byte) ifaceDesc.getBInterfaceNumber(), ! (byte) ifaceDesc.getBAlternateSetting(),(byte) ifaceDesc.getBNumEndpoints(), ! (byte) ifaceDesc.getBInterfaceClass(),(byte) ifaceDesc.getBInterfaceSubClass(), ! (byte) ifaceDesc.getBInterfaceProtocol(),(byte) ifaceDesc.getIInterface()); ! // log(LOG_HOTPLUG, FUNC, CLASS, "buildInterface","new interface descriptor " + desc); ! ! UsbInterfaceImp iface = new UsbInterfaceImp(usbConfig, desc); ! boolean active = ((0 == ifaceDesc.getBAlternateSetting())? true : false); ! /* If the config is not active, neither are its interface settings */ ! if(usbConfig.isActive() && active) ! { ! // log(LOG_HOTPLUG, FUNC, CLASS, "buildInterface","inteface is active"); ! iface.setActiveSettingNumber(iface.getUsbInterfaceDescriptor().bAlternateSetting()); } ! else { ! log(LOG_HOTPLUG, FUNC, CLASS, "buildInterface","inteface not active"); ! } ! WindowsDeviceOsImp windowsDeviceOsImp = (WindowsDeviceOsImp) iface.getUsbConfigurationImp().getUsbDeviceImp(); ! WindowsInterfaceOsImp windowsInterfaceOsImp = new WindowsInterfaceOsImp(iface, windowsDeviceOsImp); ! iface.setUsbInterfaceOsImp(windowsInterfaceOsImp); - for (int i = 0; i < ifaceDesc.getBNumEndpoints(); i++) - { - buildEndpoint(iface, Libusb.usb_endpoint_descriptor_index(ifaceDesc.getEndpoint(),i)); - } - // log(LOG_HOTPLUG, FUNC, CLASS, "buildInterface","Leaving with interface " + iface); - } /** ! * @param iface ! * @param usb_endpoint_descriptor ! */ private static void buildEndpoint(UsbInterfaceImp iface,usb_endpoint_descriptor endPointDesc) { ! UsbEndpointDescriptorImp desc = ! new UsbEndpointDescriptorImp( ! (byte) endPointDesc.getBLength(), ! (byte) endPointDesc.getBDescriptorType(), ! (byte) endPointDesc.getBEndpointAddress(), ! (byte) endPointDesc.getBmAttributes(), ! (byte) endPointDesc.getBInterval(), ! (short) endPointDesc.getWMaxPacketSize()); UsbEndpointImp ep = new UsbEndpointImp(iface, desc); UsbPipeImp pipe = null; ! WindowsInterfaceOsImp windowsInterfaceOsImp = ! (WindowsInterfaceOsImp) iface.getUsbInterfaceOsImp(); switch ((int) ep.getType()) --- 581,681 ---- } ! // If the device was not found in the list, it must be new. Add it to the connected list if(!found) { ! if(log.isDebugEnabled()) log.debug(method+" found new device"); connected.add(device); attachParentUsbPort(hub,device); } } ! /** ! * looks at the bus through libusb and attempts to update our knowlege of the system ! * by putting new devices into the connectedDevices list and removing still present items from the ! * disconnected List ! * @param services ! * @param connectedDevices - at entry contains no devices, at exit contains newly found devices ! * @param disconnectedDevices -at entry contains all known devices, at exit contains newly removed devices ! * @return 0 if no change, else -1 ! */ ! static int nativeTopologyUpdater(WindowsUsbServices services, List connectedDevices, List disconnectedDevices) { ! String method = "nativeTopologyUpdater()"; ! UsbHubImp rootHub = services.getRootUsbHubImp(); ! if (rootHub == null) ! { // this shouldn't happen, as the root hub is setup during initialisation ! throw new RuntimeException("The (virtual) root hub couldn't be retrieved."); } ! // acquire a lock, so we don't interfere with others trying to access libusb ! mutex.acquire(); ! try ! { ! int busCount = Libusb.usb_find_busses(); ! int deviceCount = Libusb.usb_find_devices(); ! if(log.isDebugEnabled()) log.debug(method + " Found " + busCount + " new busses. and " + deviceCount + " new devices."); ! // if no devices have changed do a quick exit as the calling method looks at the return value ! // to determin if more work has to be done ! if (deviceCount == 0) ! return( 0 ); ! // if we get here a change has been detected by libusb, examine the structure of the bus as presented by libusb to ! // what has changed. To do this we build all the devices listed in libusb and compare them to our internal list ! usb_bus libusb_bus = Libusb.usb_get_busses(); ! while (libusb_bus != null) ! {// for all busses ! log.debug(""); ! log.debug( method +" Scanning bus " + libusb_bus.getDirname()); ! usb_device libusb_dev = libusb_bus.getDevices(); ! while (libusb_dev != null) ! { // for all devices on this bus ! if(log.isDebugEnabled()) log.debug(method + " Device: " + libusb_dev.getFilename()); ! if (libusb_dev.getConfig() == null) ! { ! log(LOG_HOTPLUG, ERROR, CLASS, method,"Couldn't retrieve descriptors for device '"+ libusb_bus.getDirname() + "/" + libusb_dev.getFilename() + "'"); ! libusb_dev = libusb_dev.getNext(); ! continue; ! } ! UsbDeviceImp usbDev = buildDevice(libusb_dev, libusb_bus ); ! // usbDev is a device that is being reported as existing by libusb ! // if it is found in our list of disconnectedDevices, remove it and add it to ! // connected devices. ! checkUsbDeviceImp(rootHub, usbDev, disconnectedDevices, connectedDevices); ! libusb_dev = libusb_dev.getNext(); ! } // end for all devices on this bus ! libusb_bus = libusb_bus.getNext(); ! } // end for all busses } ! finally { ! mutex.release(); } ! return -1; ! } /** ! * @param iface ! * @param usb_endpoint_descriptor ! */ private static void buildEndpoint(UsbInterfaceImp iface,usb_endpoint_descriptor endPointDesc) { ! UsbEndpointDescriptorImp desc = ! new UsbEndpointDescriptorImp((byte) endPointDesc.getBLength(),(byte) endPointDesc.getBDescriptorType(), ! (byte) endPointDesc.getBEndpointAddress(),(byte) endPointDesc.getBmAttributes(), ! (byte) endPointDesc.getBInterval(),(short) endPointDesc.getWMaxPacketSize()); UsbEndpointImp ep = new UsbEndpointImp(iface, desc); UsbPipeImp pipe = null; ! WindowsInterfaceOsImp windowsInterfaceOsImp = (WindowsInterfaceOsImp) iface.getUsbInterfaceOsImp(); switch ((int) ep.getType()) *************** *** 702,738 **** // pipe.setUsbPipeOsImp( new WindowsIsochronousPipeImp( pipe, windowsInterfaceOsImp ) ); // break; ! case UsbConst.ENDPOINT_TYPE_CONTROL : ! pipe = new UsbControlPipeImp(ep, null); ! pipe.setUsbPipeOsImp( ! new WindowsPipeOsImp( ! (UsbControlPipeImp) pipe, windowsInterfaceOsImp)); ! ! break; ! ! case UsbConst.ENDPOINT_TYPE_ISOCHRONOUS : ! pipe = new UsbPipeImp(ep, null); ! pipe.setUsbPipeOsImp( ! new WindowsPipeOsImp(pipe, windowsInterfaceOsImp)); ! ! break; ! ! case UsbConst.ENDPOINT_TYPE_BULK : ! pipe = new UsbPipeImp(ep, null); ! pipe.setUsbPipeOsImp( ! new WindowsPipeOsImp(pipe, windowsInterfaceOsImp)); ! break; ! case UsbConst.ENDPOINT_TYPE_INTERRUPT : ! pipe = new UsbPipeImp(ep, null); ! pipe.setUsbPipeOsImp( ! new WindowsPipeOsImp(pipe, windowsInterfaceOsImp)); ! break; ! default : ! String emsg = "Invalid UsbEndpoint type " + ep.getType(); ! log.error("buildEndpoint() "+emsg); ! throw new RuntimeException(emsg); } } --- 691,718 ---- // pipe.setUsbPipeOsImp( new WindowsIsochronousPipeImp( pipe, windowsInterfaceOsImp ) ); // break; ! case UsbConst.ENDPOINT_TYPE_CONTROL : ! pipe = new UsbControlPipeImp(ep, null); ! pipe.setUsbPipeOsImp(new WindowsPipeOsImp((UsbControlPipeImp) pipe, windowsInterfaceOsImp)); ! break; ! case UsbConst.ENDPOINT_TYPE_ISOCHRONOUS : ! pipe = new UsbPipeImp(ep, null); ! pipe.setUsbPipeOsImp(new WindowsPipeOsImp(pipe, windowsInterfaceOsImp)); ! break; ! case UsbConst.ENDPOINT_TYPE_BULK : ! pipe = new UsbPipeImp(ep, null); ! pipe.setUsbPipeOsImp(new WindowsPipeOsImp(pipe, windowsInterfaceOsImp)); ! break; ! case UsbConst.ENDPOINT_TYPE_INTERRUPT : ! pipe = new UsbPipeImp(ep, null); ! pipe.setUsbPipeOsImp(new WindowsPipeOsImp(pipe, windowsInterfaceOsImp)); ! break; ! default : ! String emsg = "Invalid UsbEndpoint type " + ep.getType(); ! log.error("buildEndpoint() "+emsg); ! throw new RuntimeException(emsg); } } *************** *** 740,898 **** /** ! * Creates a UsbDevice or UsbHub, depending on the type of ! * argument dev, fills in the values from the config of dev ! * and checks, whether this device ! * @param dev ! * @param bus ! */ ! static UsbDeviceImp buildDevice( usb_device dev, usb_bus bus) { ! String meth = "buildDevice"; ! ! log(LOG_HOTPLUG, FUNC, CLASS, meth,"Entered buildDevice with device " + dev.getFilename()); ! ! UsbDeviceImp usbDev; ! if( dev.getDescriptor().getBDeviceClass() == Libusb.USB_CLASS_HUB) { ! log(LOG_HOTPLUG, DEBUG, CLASS, meth, "Device is a hub."); ! ! // note that libusb doesn't give us information about ! // the number of ports ! usbDev = new WindowsHubOsImp(dev); } else { ! log(LOG_HOTPLUG, DEBUG, CLASS, meth, "Device is NOT a hub."); ! usbDev = new WindowsDeviceOsImp(dev); ! ! // libusb doesn't tell the speed ! usbDev.setSpeed(UsbConst.DEVICE_SPEED_UNKNOWN); ! // now build all configurations ! for (int i = 0; i < dev.getDescriptor().getBNumConfigurations(); i++) ! { ! buildConfig(usbDev,Libusb.usb_config_descriptor_index(dev.getConfig(),i)); ! } ! } ! if(log.isDebugEnabled()) { ! log.debug("buildDevice() Leaving buildDevice with device " + dev.getFilename()); } - return(usbDev); } ! /** ! * looks at the bus through libusb and attempts to update our knowlege of the system ! * by putting new devices into the connectedDevices list and removing still present items from the ! * disconnected List ! * @param services ! * @param connectedDevices - at entry contains no devices, at exit contains newly found devices ! * @param disconnectedDevices -at entry contains all known devices, at exit contains newly removed devices ! * @return 0 if no change, else -1 ! */ ! static int nativeTopologyUpdater(WindowsUsbServices services, List connectedDevices, List disconnectedDevices) { ! String method = "topologyUpdater"; ! log(LOG_DEFAULT, FUNC, CLASS, method, "Entering topologyUpdater."); ! UsbHubImp rootHub = services.getRootUsbHubImp(); ! if (rootHub == null) ! { ! // this shouldn't happen, as the root hub is setup during initialisation ! throw new RuntimeException("The (virtual) root hub couldn't be retrieved."); ! } ! // acquire a lock, so we don't interfere with others trying to access libusb ! mutex.acquire(); ! try { ! int busCount = Libusb.usb_find_busses(); ! int deviceCount = Libusb.usb_find_devices(); ! ! String msg = "Found " + busCount + " new busses. and " + deviceCount + " new devices."; ! log(LOG_HOTPLUG, DEBUG, CLASS, method, msg); ! ! if (deviceCount == 0) ! { ! // nothing has changed, so all devices which ! // were present before (they are in disconnectedDevices) ! // are still present, now ! Iterator iterator = disconnectedDevices.iterator(); ! while(iterator.hasNext()) ! { ! connectedDevices.add(iterator.next()); ! iterator.remove(); ! } ! return 0; ! } ! ! usb_bus libusb_bus = Libusb.usb_get_busses(); ! log.debug(" disconnectedDevices size: "+disconnectedDevices.size()); ! ! ! while (libusb_bus != null) ! { ! msg = "Scanning bus " + libusb_bus.getDirname(); ! log.debug(""); ! log.debug(""); ! log(LOG_HOTPLUG, DEBUG, CLASS, method, msg); ! ! usb_device libusb_dev = libusb_bus.getDevices(); - while (libusb_dev != null) - { - // usb_device_descriptor devDesc = libusb_dev.getDescriptor(); - if(log.isDebugEnabled()) - { - log.debug(""); - msg = "Device: " + libusb_dev.getFilename(); - log(LOG_HOTPLUG, DEBUG, CLASS, method, msg); - } ! if (libusb_dev.getConfig() == null) ! { ! log(LOG_HOTPLUG, ERROR, CLASS, method,"Couldn't retrieve descriptors for device '"+ libusb_bus.getDirname() + "/" + libusb_dev.getFilename() + "'"); ! libusb_dev = libusb_dev.getNext(); ! continue; ! } ! // for( int i = 0; i < libusb_dev.getDescriptor().getBNumConfigurations();i++) ! // { ! // usb_config_descriptor config = Libusb.usb_config_descriptor_index(libusb_dev.getConfig(),i); ! // if(log.isDebugEnabled()) ! // printConfiguration(config); ! // } ! // if( devDesc.getBDeviceClass() == Libusb.USB_CLASS_HUB) ! // { ! // UsbDeviceImp usbDev = buildDevice(libusb_dev, libusb_bus ); ! // log.debug(method+" device is Hub, skipping"); ! // } ! // else ! { ! UsbDeviceImp usbDev = buildDevice(libusb_dev, libusb_bus ); ! // usbDev is a device that is being reported as existing by libusb ! // if it is found in our list of disconnectedDevices, remove it and add it to ! // connected devices. ! checkUsbDeviceImp(rootHub, usbDev, disconnectedDevices, connectedDevices); ! } ! libusb_dev = libusb_dev.getNext(); ! } ! libusb_bus = libusb_bus.getNext(); ! } ! log.debug(" disconnectedDevices size: "+disconnectedDevices.size()); ! log.debug(" connectedDevices size: "+connectedDevices.size()); ! } ! finally { ! mutex.release(); } ! ! return -1; } /** * Converts the bytes in argument buf to a String --- 720,824 ---- /** ! * @param usbConfig ! * @param ifaceDesc ! */ ! private static void buildInterface(UsbConfigurationImp usbConfig, usb_interface_descriptor ifaceDesc) { ! UsbInterfaceDescriptorImp desc = new UsbInterfaceDescriptorImp((byte) ifaceDesc.getBLength(), ! (byte) ifaceDesc.getBDescriptorType(),(byte) ifaceDesc.getBInterfaceNumber(), ! (byte) ifaceDesc.getBAlternateSetting(),(byte) ifaceDesc.getBNumEndpoints(), ! (byte) ifaceDesc.getBInterfaceClass(),(byte) ifaceDesc.getBInterfaceSubClass(), ! (byte) ifaceDesc.getBInterfaceProtocol(),(byte) ifaceDesc.getIInterface()); ! UsbInterfaceImp iface = new UsbInterfaceImp(usbConfig, desc); ! boolean active = ((0 == ifaceDesc.getBAlternateSetting())? true : false); ! /* If the config is not active, neither are its interface settings */ ! if(usbConfig.isActive() && active) { ! iface.setActiveSettingNumber(iface.getUsbInterfaceDescriptor().bAlternateSetting()); } else { ! log(LOG_HOTPLUG, FUNC, CLASS, "buildInterface","inteface not active"); ! ! } ! WindowsDeviceOsImp windowsDeviceOsImp = (WindowsDeviceOsImp) iface.getUsbConfigurationImp().getUsbDeviceImp(); ! WindowsInterfaceOsImp windowsInterfaceOsImp = new WindowsInterfaceOsImp(iface, windowsDeviceOsImp); ! iface.setUsbInterfaceOsImp(windowsInterfaceOsImp); ! for (int i = 0; i < ifaceDesc.getBNumEndpoints(); i++) { ! buildEndpoint(iface, Libusb.usb_endpoint_descriptor_index(ifaceDesc.getEndpoint(),i)); } } ! private static void buildConfig(UsbDeviceImp usbDev,usb_config_descriptor config) { ! UsbConfigurationDescriptorImp desc = new UsbConfigurationDescriptorImp((byte) config.getBLength(), ! (byte) config.getBDescriptorType(),(short) config.getWTotalLength(), ! (byte) config.getBNumInterfaces(),(byte) config.getBConfigurationValue(), ! (byte) config.getIConfiguration(),(byte) config.getBmAttributes(), ! (byte) config.getMaxPower()); ! UsbConfigurationImp usbConfig = new UsbConfigurationImp(usbDev, desc); ! usbDev.addUsbConfigurationImp(usbConfig); ! // FIXME: since most devices only support one configuration we will use the first one as default ! // this is probably ok for devices that support more than one configuration as well ! // unless it has been somehow previously set ! if(config.getBConfigurationValue() == 1) ! { ! // log(LOG_HOTPLUG, FUNC, CLASS, "buildConfiguration","WARNING Using config " + config.getBConfigurationValue()+" as active; no checking."); ! config.setIConfiguration((byte)1); ! usbDev.setActiveUsbConfigurationNumber((byte)config.getBConfigurationValue()); ! } ! ! for (int i = 0; i < config.getBNumInterfaces(); i++) ! { ! usb_interface iface; ! iface = Libusb.usb_interface_index(config.get_interface(),i); ! for (int j = 0; j < iface.getNum_altsetting(); j++) { ! usb_interface_descriptor ifaceDesc; ! ifaceDesc = Libusb.usb_interface_descriptor_index(iface.getAltsetting(),j); ! buildInterface(usbConfig, ifaceDesc); ! } ! } ! } ! /** ! * Creates a UsbDevice or UsbHub, depending on the type of ! * argument dev, fills in the values from the config of dev ! * and checks, whether this device ! * @param dev ! * @param bus ! */ ! static UsbDeviceImp buildDevice( usb_device dev, usb_bus bus) ! { ! UsbDeviceImp usbDev; ! if( dev.getDescriptor().getBDeviceClass() == Libusb.USB_CLASS_HUB) ! { ! usbDev = new WindowsHubOsImp(dev); ! // note that libusb doesn't give us information about the number of ports ! } ! else ! { ! usbDev = new WindowsDeviceOsImp(dev); ! usbDev.setSpeed(UsbConst.DEVICE_SPEED_UNKNOWN); // libusb doesn't tell the speed ! // now build all configurations ! for (int i = 0; i < dev.getDescriptor().getBNumConfigurations(); i++) { ! buildConfig(usbDev,Libusb.usb_config_descriptor_index(dev.getConfig(),i)); } ! } ! return(usbDev); } + /** * Converts the bytes in argument buf to a String *************** *** 913,916 **** --- 839,843 ---- } + //************************************************************************* // Creation methods |
From: Mike C. <mc...@us...> - 2008-08-18 21:31:11
|
Update of /cvsroot/javax-usb/javax-usb-libusb/src/com/mcreations/usb/windows In directory sc8-pr-cvs17.sourceforge.net:/tmp/cvs-serv12959/src/com/mcreations/usb/windows Modified Files: JavaxUsb.java WindowsUsbServices.java Log Message: better, but still not perfect port enumeration during hot plugging. Needs better release of ports when disconnected Index: WindowsUsbServices.java =================================================================== RCS file: /cvsroot/javax-usb/javax-usb-libusb/src/com/mcreations/usb/windows/WindowsUsbServices.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** WindowsUsbServices.java 18 Aug 2008 18:52:04 -0000 1.4 --- WindowsUsbServices.java 18 Aug 2008 21:31:07 -0000 1.5 *************** *** 320,323 **** --- 320,324 ---- device.disconnect(); listenerImp.usbDeviceDetached(new UsbServicesEvent(this, (UsbDevice)device )); + } *************** *** 330,342 **** // is really needed in libusb implementation // setActiveConfigAndInterfaceSettings(device); ! try ! { ! device.getParentUsbPortImp().attachUsbDeviceImp(device); ! } ! catch (IllegalArgumentException iae) ! { ! // device is already attached ! continue; ! } // Let's wait a bit before each new device's event, so its driver can have some time to --- 331,345 ---- // is really needed in libusb implementation // setActiveConfigAndInterfaceSettings(device); ! // attachUsbDeviceImp now occures in JavaUsb.java ! // try ! // { ! // device.getParentUsbPortImp().attachUsbDeviceImp(device); ! // } ! // catch (IllegalArgumentException iae) ! // { ! // if(log.isDebugEnabled()) log.debug( "updateTopology() while attaching UsbDeviceImp "+iae ); ! // // device is already attached ! // continue; ! // } // Let's wait a bit before each new device's event, so its driver can have some time to *************** *** 344,348 **** try { ! if(!device.isUsbHub()) Thread.sleep(topologyUpdateNewDeviceDelay); } catch (InterruptedException iE) --- 347,356 ---- try { ! // if(!device.isUsbHub()) ! if( !(device instanceof WindowsHubOsImp) ) ! { ! if(log.isDebugEnabled()) log.debug( "sleeping to let new device settle" ); ! Thread.sleep(topologyUpdateNewDeviceDelay); ! } } catch (InterruptedException iE) Index: JavaxUsb.java =================================================================== RCS file: /cvsroot/javax-usb/javax-usb-libusb/src/com/mcreations/usb/windows/JavaxUsb.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** JavaxUsb.java 18 Aug 2008 18:52:04 -0000 1.6 --- JavaxUsb.java 18 Aug 2008 21:31:07 -0000 1.7 *************** *** 511,515 **** * an existing device, the old device is retained in the disconnected list, and the new device is returned. * @param hub The parent UsbHubImp. - * @param p The parent port number. * @param device The UsbDeviceImp to add. * @param currentDevices - the list of devices that were connected before this call to topology update --- 511,514 ---- *************** *** 518,534 **** * @return The new UsbDeviceImp or existing UsbDeviceImp. */ ! private static void checkUsbDeviceImp(UsbHubImp hub, int p, UsbDeviceImp device, List currentDevices, List connected) { String meth = "checkUsbDeviceImp"; ! byte port = (byte)p; ! if(log.isDebugEnabled()) log.debug( meth +"Entered with port" + p+" our port num "+port ); ! UsbPortImp usbPortImp = hub.getUsbPortImp((byte)port); ! if (null == usbPortImp) ! { ! log.debug(meth+" WARNING resizing port"); ! hub.resize((byte)port); ! usbPortImp = hub.getUsbPortImp((byte)port); ! } if(log.isDebugEnabled()) log.debug( meth+ " Hub now has " + hub.getNumberOfPorts() + " ports"); --- 517,533 ---- * @return The new UsbDeviceImp or existing UsbDeviceImp. */ ! private static void checkUsbDeviceImp(UsbHubImp hub, UsbDeviceImp device, List currentDevices, List connected) { String meth = "checkUsbDeviceImp"; ! // byte port = (byte)p; ! // if(log.isDebugEnabled()) log.debug( meth +" Entered with port" + p+" our port num "+port ); ! // UsbPortImp usbPortImp = hub.getUsbPortImp((byte)port); ! // if (null == usbPortImp) ! // { ! // log.debug(meth+" WARNING resizing port"); ! // hub.resize((byte)port); ! // usbPortImp = hub.getUsbPortImp((byte)port); ! // } if(log.isDebugEnabled()) log.debug( meth+ " Hub now has " + hub.getNumberOfPorts() + " ports"); *************** *** 552,556 **** if(log.isDebugEnabled()) log.debug(meth+" adding new device"); connected.add(device); ! device.setParentUsbPortImp(usbPortImp); } --- 551,556 ---- if(log.isDebugEnabled()) log.debug(meth+" adding new device"); connected.add(device); ! // device.setParentUsbPortImp(usbPortImp); ! attachParentUsbPort(hub,device); } *************** *** 558,561 **** --- 558,589 ---- } + private static void attachParentUsbPort(UsbHubImp hub, UsbDeviceImp device) + { + if(log.isDebugEnabled()) log.debug("attachParentUsbPort"); + List ports = hub.getUsbPorts(); + Iterator iterator = ports.iterator(); + while(iterator.hasNext()) + { + UsbPortImp usbPortImp = (UsbPortImp)iterator.next(); + if(usbPortImp.isUsbDeviceAttached()) continue; + if(log.isDebugEnabled()) log.debug("attachParentUsbPort(), found empty port"); + device.setParentUsbPortImp(usbPortImp); + usbPortImp.attachUsbDeviceImp(device); + return; + } + + byte port = hub.getNumberOfPorts(); + log.debug("attachParentUsbPort(), no empty ports found, out of "+ port+" ports"); + port++; + UsbPortImp usbPortImp = hub.getUsbPortImp((byte)port); + if (null == usbPortImp) + { + log.debug("attachParentUsbPort(), WARNING resizing port"); + hub.resize((byte)port); + usbPortImp = hub.getUsbPortImp((byte)port); + } + device.setParentUsbPortImp(usbPortImp); + usbPortImp.attachUsbDeviceImp(device); + } private static void buildConfig(UsbDeviceImp usbDev,usb_config_descriptor config) *************** *** 717,724 **** * @param dev * @param bus - * @param parentHub - * @param parentport */ ! static UsbDeviceImp buildDevice( usb_device dev, usb_bus bus, UsbHubImp parentHub, int parentport) { String meth = "buildDevice"; --- 745,750 ---- * @param dev * @param bus */ ! static UsbDeviceImp buildDevice( usb_device dev, usb_bus bus) { String meth = "buildDevice"; *************** *** 753,758 **** if(log.isDebugEnabled()) { ! log.debug("Leaving buildDevice with device " + dev.getFilename()); ! log.debug(""); } return(usbDev); --- 779,783 ---- if(log.isDebugEnabled()) { ! log.debug("buildDevice() Leaving buildDevice with device " + dev.getFilename()); } return(usbDev); *************** *** 809,817 **** log.debug(" disconnectedDevices size: "+disconnectedDevices.size()); - int portNum = 1; while (libusb_bus != null) { msg = "Scanning bus " + libusb_bus.getDirname(); log(LOG_HOTPLUG, DEBUG, CLASS, method, msg); --- 834,843 ---- log.debug(" disconnectedDevices size: "+disconnectedDevices.size()); while (libusb_bus != null) { msg = "Scanning bus " + libusb_bus.getDirname(); + log.debug(""); + log.debug(""); log(LOG_HOTPLUG, DEBUG, CLASS, method, msg); *************** *** 823,826 **** --- 849,853 ---- if(log.isDebugEnabled()) { + log.debug(""); msg = "Device: " + libusb_dev.getFilename(); log(LOG_HOTPLUG, DEBUG, CLASS, method, msg); *************** *** 842,856 **** // if( devDesc.getBDeviceClass() == Libusb.USB_CLASS_HUB) // { ! // UsbDeviceImp usbDev = buildDevice(libusb_dev, libusb_bus, rootHub, portNum++ ); ! // portNum++; // log.debug(method+" device is Hub, skipping"); // } // else { ! UsbDeviceImp usbDev = buildDevice(libusb_dev, libusb_bus, rootHub, portNum ); // usbDev is a device that is being reported as existing by libusb // if it is found in our list of disconnectedDevices, remove it and add it to // connected devices. ! checkUsbDeviceImp(rootHub, portNum++, usbDev, disconnectedDevices, connectedDevices); } libusb_dev = libusb_dev.getNext(); --- 869,882 ---- // if( devDesc.getBDeviceClass() == Libusb.USB_CLASS_HUB) // { ! // UsbDeviceImp usbDev = buildDevice(libusb_dev, libusb_bus ); // log.debug(method+" device is Hub, skipping"); // } // else { ! UsbDeviceImp usbDev = buildDevice(libusb_dev, libusb_bus ); // usbDev is a device that is being reported as existing by libusb // if it is found in our list of disconnectedDevices, remove it and add it to // connected devices. ! checkUsbDeviceImp(rootHub, usbDev, disconnectedDevices, connectedDevices); } libusb_dev = libusb_dev.getNext(); *************** *** 859,862 **** --- 885,889 ---- } log.debug(" disconnectedDevices size: "+disconnectedDevices.size()); + log.debug(" connectedDevices size: "+connectedDevices.size()); } finally |
From: Mike C. <mc...@us...> - 2008-08-18 18:52:11
|
Update of /cvsroot/javax-usb/javax-usb-libusb/src/com/mcreations/usb/windows In directory sc8-pr-cvs17.sourceforge.net:/tmp/cvs-serv4307 Modified Files: JavaxUsb.java WindowsUsbServices.java Log Message: Some improvements to hot plugging. Better testing of devices when creating connected/disconnected lists. Still needs better testing Index: WindowsUsbServices.java =================================================================== RCS file: /cvsroot/javax-usb/javax-usb-libusb/src/com/mcreations/usb/windows/WindowsUsbServices.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** WindowsUsbServices.java 13 Aug 2008 21:08:39 -0000 1.3 --- WindowsUsbServices.java 18 Aug 2008 18:52:04 -0000 1.4 *************** *** 304,312 **** List connectedDevices = new ArrayList(); List disconnectedDevices = new ArrayList(); ! fillDeviceList(getRootUsbHubImp(),disconnectedDevices); while(disconnectedDevices.remove(getRootUsbHubImp())); ! JavaxUsb.nativeTopologyUpdater(this, connectedDevices, disconnectedDevices); Iterator iterator = disconnectedDevices.iterator(); --- 304,315 ---- List connectedDevices = new ArrayList(); List disconnectedDevices = new ArrayList(); ! fillDeviceList(getRootUsbHubImp(),disconnectedDevices); while(disconnectedDevices.remove(getRootUsbHubImp())); ! int updates = JavaxUsb.nativeTopologyUpdater(this, connectedDevices, disconnectedDevices); ! if(updates == 0) return; // if there are no changes go home early ! // connectedDevices contains all new devices found ! // disconnectedDevices contains all devices removed Iterator iterator = disconnectedDevices.iterator(); *************** *** 341,345 **** try { ! Thread.sleep(topologyUpdateNewDeviceDelay); } catch (InterruptedException iE) --- 344,348 ---- try { ! if(!device.isUsbHub()) Thread.sleep(topologyUpdateNewDeviceDelay); } catch (InterruptedException iE) Index: JavaxUsb.java =================================================================== RCS file: /cvsroot/javax-usb/javax-usb-libusb/src/com/mcreations/usb/windows/JavaxUsb.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** JavaxUsb.java 13 Aug 2008 21:08:39 -0000 1.5 --- JavaxUsb.java 18 Aug 2008 18:52:04 -0000 1.6 *************** *** 27,31 **** import net.sf.libusb.usb_config_descriptor; import net.sf.libusb.usb_device; ! import net.sf.libusb.usb_device_descriptor; import net.sf.libusb.usb_endpoint_descriptor; import net.sf.libusb.usb_interface; --- 27,31 ---- import net.sf.libusb.usb_config_descriptor; import net.sf.libusb.usb_device; ! //import net.sf.libusb.usb_device_descriptor; import net.sf.libusb.usb_endpoint_descriptor; import net.sf.libusb.usb_interface; *************** *** 43,46 **** --- 43,47 ---- import javax.usb.UsbException; + import java.io.UnsupportedEncodingException; /** *************** *** 61,65 **** private static Mutex mutex = new Mutex(); ! private static void printEndpoint(usb_endpoint_descriptor endpoint) { --- 62,66 ---- private static Mutex mutex = new Mutex(); ! /* private static void printEndpoint(usb_endpoint_descriptor endpoint) { *************** *** 148,152 **** // " bSynchAddress: " + endpoint.getBSynchAddress()); } ! private static void printIfaceDesc(usb_interface_descriptor iface) { --- 149,154 ---- // " bSynchAddress: " + endpoint.getBSynchAddress()); } ! */ ! /* private static void printIfaceDesc(usb_interface_descriptor iface) { *************** *** 186,191 **** } } ! ! private static void printInterface(usb_interface iface) { int i; --- 188,193 ---- } } ! */ ! /* private static void printInterface(usb_interface iface) { int i; *************** *** 198,203 **** } } ! ! private static void printConfiguration(usb_config_descriptor config) { int i; --- 200,205 ---- } } ! */ ! /* private static void printConfiguration(usb_config_descriptor config) { int i; *************** *** 230,234 **** } } ! /** * Log messages to System.err, if the level <= current traceLevel. --- 232,236 ---- } } ! */ /** * Log messages to System.err, if the level <= current traceLevel. *************** *** 392,395 **** --- 394,398 ---- } + /** * Convert the error code to a UsbException. *************** *** 402,405 **** --- 405,409 ---- } + /** * Convert the error code to a UsbException using the specified text. *************** *** 418,421 **** --- 422,426 ---- } + //************************************************************************* // Native methods *************** *** 456,460 **** /** ! * Return if the specified devices appear to be equal. * <p> * If either of the device's descriptors are null, this returns false. --- 461,468 ---- /** ! * Return if the compared devices are the same device. ! * FIXME relies on the device serial number string to be unique for each device (this may not always be true ! * if we could examine the port number / path, we could make a more definative argument ! * Testing starts with easy things to compare and becomes progressivly more complicated * <p> * If either of the device's descriptors are null, this returns false. *************** *** 463,469 **** * @return If the devices appear to be equal. */ ! protected static boolean isUsbDevicesEqual( ! UsbDeviceImp dev1, ! UsbDeviceImp dev2) { try --- 471,475 ---- * @return If the devices appear to be equal. */ ! protected static boolean isUsbDevicesEqual(UsbDeviceImp dev1,UsbDeviceImp dev2) { try *************** *** 472,484 **** UsbDeviceDescriptor desc2 = dev2.getUsbDeviceDescriptor(); ! return (dev1.isUsbHub() == dev1.isUsbHub()) ! && (dev1.getSpeed() == dev2.getSpeed()) && desc1.equals(desc2); } catch (NullPointerException npE) { ! return false; } } /** * Check for the existence of a device in the given <code>connected</code> and --- 478,502 ---- UsbDeviceDescriptor desc2 = dev2.getUsbDeviceDescriptor(); ! if( dev1.isUsbHub() != dev1.isUsbHub() ) return(false); ! if( dev1.getSpeed() != dev2.getSpeed() ) return(false); ! if( !desc1.equals(desc2) ) return(false); ! if( !dev1.getSerialNumberString().equals(dev2.getSerialNumberString() )) return(false); ! return(true); ! } ! catch (UnsupportedEncodingException uee) ! { ! return(false); } catch (NullPointerException npE) { ! return(false); ! } ! catch (UsbException ue) ! { ! return(false); } } + /** * Check for the existence of a device in the given <code>connected</code> and *************** *** 495,560 **** * @param p The parent port number. * @param device The UsbDeviceImp to add. ! * @param disconnected The List of disconnected devices. ! * @param connected The List of connected devices. * @return The new UsbDeviceImp or existing UsbDeviceImp. */ ! private static UsbDeviceImp checkUsbDeviceImp( ! UsbHubImp hub, ! int p, ! UsbDeviceImp device, ! List connected, ! List disconnected) { String meth = "checkUsbDeviceImp"; ! log(LOG_HOTPLUG, FUNC, CLASS, meth, "Entered with device " + device); ! ! byte port = (byte) p; ! UsbPortImp usbPortImp = hub.getUsbPortImp(port); ! if (null == usbPortImp) { ! hub.resize(port); ! usbPortImp = hub.getUsbPortImp(port); } ! log( ! LOG_HOTPLUG, DEBUG, CLASS, meth, ! meth+ " Hub now has " + hub.getNumberOfPorts() + " ports"); ! ! UsbDeviceImp existingDevice = usbPortImp.getUsbDeviceImp(); ! // If they are equal, it means, that the ! // device was disconnected and then reconnected, ! // because the main loop in topologyUpdater only ! // calls buildDevice in case of changes in the ! // topology (Libusb.usb_find_devices != 0). ! if (isUsbDevicesEqual(existingDevice, device)) { ! disconnected.remove(existingDevice); ! log( ! LOG_HOTPLUG, FUNC, CLASS, meth, ! "Removed disconnected device " + existingDevice); } ! if (usbPortImp.isUsbDeviceAttached()) ! { ! usbPortImp.detachUsbDeviceImp(usbPortImp.getUsbDeviceImp()); } ! connected.add(device); ! device.setParentUsbPortImp(usbPortImp); ! log(LOG_HOTPLUG, FUNC, CLASS, meth, "Leaving with device " + device); ! ! return device; } private static void buildConfig(UsbDeviceImp usbDev,usb_config_descriptor config) { - // (*env)->CallStaticObjectMethod( - // env, JavaxUsb, createUsbConfigurationImp, usbDeviceImp, - // config_desc->bLength, config_desc->bDescriptorType, - // config_desc->wTotalLength, config_desc->bNumInterfaces, - // config_desc->bConfigurationValue, config_desc->iConfiguration, - // config_desc->bmAttributes, config_desc->MaxPower, is_active); UsbConfigurationDescriptorImp desc = new UsbConfigurationDescriptorImp((byte) config.getBLength(), (byte) config.getBDescriptorType(),(short) config.getWTotalLength(), --- 513,564 ---- * @param p The parent port number. * @param device The UsbDeviceImp to add. ! * @param currentDevices - the list of devices that were connected before this call to topology update ! * @param disconnected The List of all devices that can possibly disconnected ! * @param connected The List of connected devices that are newely connected * @return The new UsbDeviceImp or existing UsbDeviceImp. */ ! private static void checkUsbDeviceImp(UsbHubImp hub, int p, UsbDeviceImp device, List currentDevices, List connected) { String meth = "checkUsbDeviceImp"; ! byte port = (byte)p; ! ! if(log.isDebugEnabled()) log.debug( meth +"Entered with port" + p+" our port num "+port ); ! UsbPortImp usbPortImp = hub.getUsbPortImp((byte)port); if (null == usbPortImp) { ! log.debug(meth+" WARNING resizing port"); ! hub.resize((byte)port); ! usbPortImp = hub.getUsbPortImp((byte)port); } ! if(log.isDebugEnabled()) log.debug( meth+ " Hub now has " + hub.getNumberOfPorts() + " ports"); ! // look for this devices in the current device list, if found remove from the list ! // because later, the remaining items in current device list will be removed. ! boolean found = false; ! Iterator iterator = currentDevices.iterator(); ! while( iterator.hasNext()) { ! if( isUsbDevicesEqual((UsbDeviceImp)iterator.next(), device)) ! { ! iterator.remove(); ! found = true; ! } } ! // if the device was not found in the list, it must be new so add it to the connected list ! if(!found) ! { ! if(log.isDebugEnabled()) log.debug(meth+" adding new device"); ! connected.add(device); ! device.setParentUsbPortImp(usbPortImp); } ! if(log.isDebugEnabled()) log.debug(meth+ " Leaving with device " + device); } + private static void buildConfig(UsbDeviceImp usbDev,usb_config_descriptor config) { UsbConfigurationDescriptorImp desc = new UsbConfigurationDescriptorImp((byte) config.getBLength(), (byte) config.getBDescriptorType(),(short) config.getWTotalLength(), *************** *** 571,575 **** if(config.getBConfigurationValue() == 1) { ! log(LOG_HOTPLUG, FUNC, CLASS, "buildConfiguration","WARNING Using config " + config.getBConfigurationValue()+" as active; no checking."); config.setIConfiguration((byte)1); usbDev.setActiveUsbConfigurationNumber((byte)config.getBConfigurationValue()); --- 575,579 ---- if(config.getBConfigurationValue() == 1) { ! // log(LOG_HOTPLUG, FUNC, CLASS, "buildConfiguration","WARNING Using config " + config.getBConfigurationValue()+" as active; no checking."); config.setIConfiguration((byte)1); usbDev.setActiveUsbConfigurationNumber((byte)config.getBConfigurationValue()); *************** *** 579,583 **** { usb_interface iface; - // iface = Libusb.usb_interface_index(config.getInterface(),i); iface = Libusb.usb_interface_index(config.get_interface(),i); --- 583,586 ---- *************** *** 600,604 **** private static void buildInterface(UsbConfigurationImp usbConfig, usb_interface_descriptor ifaceDesc) { ! log(LOG_HOTPLUG, FUNC, CLASS, "buildInterface","Entering with config " + usbConfig); UsbInterfaceDescriptorImp desc = new UsbInterfaceDescriptorImp((byte) ifaceDesc.getBLength(), --- 603,607 ---- private static void buildInterface(UsbConfigurationImp usbConfig, usb_interface_descriptor ifaceDesc) { ! // log(LOG_HOTPLUG, FUNC, CLASS, "buildInterface","Entering with config " + usbConfig); UsbInterfaceDescriptorImp desc = new UsbInterfaceDescriptorImp((byte) ifaceDesc.getBLength(), *************** *** 608,612 **** (byte) ifaceDesc.getBInterfaceProtocol(),(byte) ifaceDesc.getIInterface()); ! log(LOG_HOTPLUG, FUNC, CLASS, "buildInterface","new interface descriptor " + desc); UsbInterfaceImp iface = new UsbInterfaceImp(usbConfig, desc); --- 611,615 ---- (byte) ifaceDesc.getBInterfaceProtocol(),(byte) ifaceDesc.getIInterface()); ! // log(LOG_HOTPLUG, FUNC, CLASS, "buildInterface","new interface descriptor " + desc); UsbInterfaceImp iface = new UsbInterfaceImp(usbConfig, desc); *************** *** 617,621 **** if(usbConfig.isActive() && active) { ! log(LOG_HOTPLUG, FUNC, CLASS, "buildInterface","inteface is active"); iface.setActiveSettingNumber(iface.getUsbInterfaceDescriptor().bAlternateSetting()); } --- 620,624 ---- if(usbConfig.isActive() && active) { ! // log(LOG_HOTPLUG, FUNC, CLASS, "buildInterface","inteface is active"); iface.setActiveSettingNumber(iface.getUsbInterfaceDescriptor().bAlternateSetting()); } *************** *** 635,639 **** } ! log(LOG_HOTPLUG, FUNC, CLASS, "buildInterface","Leaving with interface " + iface); } --- 638,642 ---- } ! // log(LOG_HOTPLUG, FUNC, CLASS, "buildInterface","Leaving with interface " + iface); } *************** *** 642,648 **** * @param usb_endpoint_descriptor */ ! private static void buildEndpoint( ! UsbInterfaceImp iface, ! usb_endpoint_descriptor endPointDesc) { UsbEndpointDescriptorImp desc = --- 645,649 ---- * @param usb_endpoint_descriptor */ ! private static void buildEndpoint(UsbInterfaceImp iface,usb_endpoint_descriptor endPointDesc) { UsbEndpointDescriptorImp desc = *************** *** 718,725 **** * @param parentHub * @param parentport - * @param connectedDevices - * @param disconnectedDevices */ ! static void buildDevice( usb_device dev, usb_bus bus, UsbHubImp parentHub, int parentport, List connectedDevices, List disconnectedDevices) { String meth = "buildDevice"; --- 719,724 ---- * @param parentHub * @param parentport */ ! static UsbDeviceImp buildDevice( usb_device dev, usb_bus bus, UsbHubImp parentHub, int parentport) { String meth = "buildDevice"; *************** *** 729,733 **** UsbDeviceImp usbDev; ! if (dev.getDescriptor().getBDeviceClass() == Libusb.USB_CLASS_HUB) { log(LOG_HOTPLUG, DEBUG, CLASS, meth, "Device is a hub."); --- 728,732 ---- UsbDeviceImp usbDev; ! if( dev.getDescriptor().getBDeviceClass() == Libusb.USB_CLASS_HUB) { log(LOG_HOTPLUG, DEBUG, CLASS, meth, "Device is a hub."); *************** *** 739,771 **** else { ! log(LOG_HOTPLUG, DEBUG, CLASS, meth, "Device is normal (NOT a hub)."); ! usbDev = new WindowsDeviceOsImp(dev); ! } ! // libusb doesn't tell the speed ! usbDev.setSpeed(UsbConst.DEVICE_SPEED_UNKNOWN); ! // now build all configurations ! for (int i = 0; i < dev.getDescriptor().getBNumConfigurations(); i++) { ! buildConfig(usbDev,Libusb.usb_config_descriptor_index(dev.getConfig(),i)); } ! ! checkUsbDeviceImp(parentHub, parentport, usbDev, connectedDevices, disconnectedDevices); ! ! log.debug("Leaving buildDevice with device " + dev.getFilename()); ! log.debug(""); } /** * @param services ! * @param connectedDevices ! * @param disconnectedDevices ! * @return */ ! static int nativeTopologyUpdater( ! WindowsUsbServices services, ! List connectedDevices, ! List disconnectedDevices) { String method = "topologyUpdater"; --- 738,773 ---- else { ! log(LOG_HOTPLUG, DEBUG, CLASS, meth, "Device is NOT a hub."); ! usbDev = new WindowsDeviceOsImp(dev); ! ! // libusb doesn't tell the speed ! usbDev.setSpeed(UsbConst.DEVICE_SPEED_UNKNOWN); ! // now build all configurations ! for (int i = 0; i < dev.getDescriptor().getBNumConfigurations(); i++) ! { ! buildConfig(usbDev,Libusb.usb_config_descriptor_index(dev.getConfig(),i)); ! } ! } ! if(log.isDebugEnabled()) { ! log.debug("Leaving buildDevice with device " + dev.getFilename()); ! log.debug(""); } ! return(usbDev); } + /** + * looks at the bus through libusb and attempts to update our knowlege of the system + * by putting new devices into the connectedDevices list and removing still present items from the + * disconnected List * @param services ! * @param connectedDevices - at entry contains no devices, at exit contains newly found devices ! * @param disconnectedDevices -at entry contains all known devices, at exit contains newly removed devices ! * @return 0 if no change, else -1 */ ! static int nativeTopologyUpdater(WindowsUsbServices services, List connectedDevices, List disconnectedDevices) { String method = "topologyUpdater"; *************** *** 773,786 **** UsbHubImp rootHub = services.getRootUsbHubImp(); - if (rootHub == null) { // this shouldn't happen, as the root hub is setup during initialisation ! throw new RuntimeException( ! "The (virtual) root hub couldn't be retrieved."); } ! // acquire a lock, so we don't interfere with others ! // trying to access libusb mutex.acquire(); --- 775,785 ---- UsbHubImp rootHub = services.getRootUsbHubImp(); if (rootHub == null) { // this shouldn't happen, as the root hub is setup during initialisation ! throw new RuntimeException("The (virtual) root hub couldn't be retrieved."); } ! // acquire a lock, so we don't interfere with others trying to access libusb mutex.acquire(); *************** *** 788,796 **** { int busCount = Libusb.usb_find_busses(); - String msg = "Found " + busCount + " new busses."; - log(LOG_HOTPLUG, DEBUG, CLASS, method, msg); - int deviceCount = Libusb.usb_find_devices(); ! msg = "Found " + deviceCount + " new devices."; log(LOG_HOTPLUG, DEBUG, CLASS, method, msg); --- 787,793 ---- { int busCount = Libusb.usb_find_busses(); int deviceCount = Libusb.usb_find_devices(); ! ! String msg = "Found " + busCount + " new busses. and " + deviceCount + " new devices."; log(LOG_HOTPLUG, DEBUG, CLASS, method, msg); *************** *** 809,861 **** } ! usb_bus bus = Libusb.usb_get_busses(); int portNum = 1; ! ! while (bus != null) { ! msg = "Scanning bus " + bus.getDirname(); log(LOG_HOTPLUG, DEBUG, CLASS, method, msg); ! usb_device dev = bus.getDevices(); ! ! // int index = 1; ! while (dev != null) { ! usb_device_descriptor devDesc = dev.getDescriptor(); ! log(LOG_HOTPLUG, DEBUG, CLASS, method, "nativeTopologyListener devDesc: "+devDesc); ! msg = "Device: " + dev.getFilename(); ! log(LOG_HOTPLUG, DEBUG, CLASS, method, msg); ! ! if (dev.getConfig() == null) { ! log( ! LOG_HOTPLUG, ERROR, CLASS, method, ! "Couldn't retrieve descriptors for device '" ! + bus.getDirname() + "/" + dev.getFilename() + "'"); ! ! dev = dev.getNext(); continue; } ! for ( ! int i = 0; ! i < dev.getDescriptor().getBNumConfigurations(); ! i++) { ! usb_config_descriptor config; ! config = Libusb.usb_config_descriptor_index(dev.getConfig(),i); ! if(log.isDebugEnabled()) printConfiguration(config); } ! ! buildDevice(dev, bus, rootHub, portNum++, connectedDevices,disconnectedDevices); ! ! dev = dev.getNext(); } ! ! bus = bus.getNext(); } } finally --- 806,862 ---- } ! usb_bus libusb_bus = Libusb.usb_get_busses(); ! log.debug(" disconnectedDevices size: "+disconnectedDevices.size()); int portNum = 1; ! ! while (libusb_bus != null) { ! msg = "Scanning bus " + libusb_bus.getDirname(); log(LOG_HOTPLUG, DEBUG, CLASS, method, msg); ! usb_device libusb_dev = libusb_bus.getDevices(); ! while (libusb_dev != null) { ! // usb_device_descriptor devDesc = libusb_dev.getDescriptor(); ! if(log.isDebugEnabled()) { ! msg = "Device: " + libusb_dev.getFilename(); ! log(LOG_HOTPLUG, DEBUG, CLASS, method, msg); ! } + if (libusb_dev.getConfig() == null) + { + log(LOG_HOTPLUG, ERROR, CLASS, method,"Couldn't retrieve descriptors for device '"+ libusb_bus.getDirname() + "/" + libusb_dev.getFilename() + "'"); + libusb_dev = libusb_dev.getNext(); continue; } ! // for( int i = 0; i < libusb_dev.getDescriptor().getBNumConfigurations();i++) ! // { ! // usb_config_descriptor config = Libusb.usb_config_descriptor_index(libusb_dev.getConfig(),i); ! // if(log.isDebugEnabled()) ! // printConfiguration(config); ! // } ! // if( devDesc.getBDeviceClass() == Libusb.USB_CLASS_HUB) ! // { ! // UsbDeviceImp usbDev = buildDevice(libusb_dev, libusb_bus, rootHub, portNum++ ); ! // portNum++; ! // log.debug(method+" device is Hub, skipping"); ! // } ! // else { ! UsbDeviceImp usbDev = buildDevice(libusb_dev, libusb_bus, rootHub, portNum ); ! // usbDev is a device that is being reported as existing by libusb ! // if it is found in our list of disconnectedDevices, remove it and add it to ! // connected devices. ! checkUsbDeviceImp(rootHub, portNum++, usbDev, disconnectedDevices, connectedDevices); } ! libusb_dev = libusb_dev.getNext(); } ! libusb_bus = libusb_bus.getNext(); } + log.debug(" disconnectedDevices size: "+disconnectedDevices.size()); } finally |
From: Mike C. <mc...@us...> - 2008-08-18 18:14:56
|
Update of /cvsroot/javax-usb/javax-usb-libusb/src/com/mcreations/usb/windows In directory sc8-pr-cvs17.sourceforge.net:/tmp/cvs-serv21247 Modified Files: Mutex.java WindowsPipeOsImp.java Log Message: when using interrupt IN, mutexs where being acquired for long periods of time, blocking the update thread (java jdk1.6.0) for long periods of time, removed mutex on interrupt in. Had to modify Mutex to allow unlock without lock for proper performance in exception conditions Index: WindowsPipeOsImp.java =================================================================== RCS file: /cvsroot/javax-usb/javax-usb-libusb/src/com/mcreations/usb/windows/WindowsPipeOsImp.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** WindowsPipeOsImp.java 5 Aug 2008 16:26:52 -0000 1.2 --- WindowsPipeOsImp.java 18 Aug 2008 18:14:52 -0000 1.3 *************** *** 226,230 **** // lock the access to the libusb - JavaxUsb.getMutex().acquire(); // log.debug("Entering submitIrp, epType: "+epType+" epDir: "+epDir+" timeout: "+timeout+" ms"); --- 226,229 ---- *************** *** 233,238 **** switch (epType) { ! case UsbConst.ENDPOINT_TYPE_BULK : ! if (epDir == UsbConst.ENDPOINT_DIRECTION_OUT) { --- 232,236 ---- switch (epType) { ! case UsbConst.ENDPOINT_TYPE_BULK : if (epDir == UsbConst.ENDPOINT_DIRECTION_OUT) { *************** *** 248,271 **** { byte[] buf; ! int toWrite = ! Math.min(requested - written, chunkSize); buf = new byte[toWrite]; System.arraycopy(data, written, buf, 0, toWrite); written += toWrite; - res = Libusb.usb_bulk_write( - handle, - getEndpointAddress(), - buf, - timeout); if (log.isDebugEnabled()) ! log.debug( ! "Called bulk_write with buffer of size " ! + buf.length + ", res = " + res); if (res != toWrite) { result = res; - break; } --- 246,264 ---- { byte[] buf; ! int toWrite = Math.min(requested - written, chunkSize); buf = new byte[toWrite]; System.arraycopy(data, written, buf, 0, toWrite); written += toWrite; + JavaxUsb.getMutex().acquire(); //FIXME not sure if this is required + res = Libusb.usb_bulk_write(handle,getEndpointAddress(),buf,timeout); + JavaxUsb.getMutex().release(); //FIXME not sure if this is required + if (log.isDebugEnabled()) ! log.debug("Called bulk_write with buffer of size "+ buf.length + ", res = " + res); if (res != toWrite) { result = res; break; } *************** *** 275,308 **** { action = "bulk read"; ! ! // byte[] bytes = new byte[64]; ! result = ! Libusb.usb_bulk_read( ! handle, ! getEndpointAddress(), ! irp.getData(), ! timeout); ! ! // fixme: remove this debug msg ! log.debug("---------- result: " + result); } - break; ! case UsbConst.ENDPOINT_TYPE_INTERRUPT : ! if (epDir == UsbConst.ENDPOINT_DIRECTION_OUT) { action = "interrupt write"; result = Libusb.usb_interrupt_write(handle,getEndpointAddress(),irp.getData(),timeout); ! } else if (epDir == UsbConst.ENDPOINT_DIRECTION_IN) { action = "interrupt read"; result = Libusb.usb_interrupt_read(handle,getEndpointAddress(),irp.getData(),timeout); } break; ! default : throw new RuntimeException("WindowsPipeOsImp.submitIrp: end point ("+epType+") type not (yet) supported!"); } --- 268,294 ---- { action = "bulk read"; ! JavaxUsb.getMutex().acquire(); //FIXME not sure if this is required ! result = Libusb.usb_bulk_read(handle,getEndpointAddress(),irp.getData(),timeout); ! JavaxUsb.getMutex().release(); //FIXME not sure if this is required } break; ! case UsbConst.ENDPOINT_TYPE_INTERRUPT : if (epDir == UsbConst.ENDPOINT_DIRECTION_OUT) { action = "interrupt write"; + JavaxUsb.getMutex().acquire(); //FIXME not sure if this is required result = Libusb.usb_interrupt_write(handle,getEndpointAddress(),irp.getData(),timeout); ! JavaxUsb.getMutex().release(); //FIXME not sure if this is required } else if (epDir == UsbConst.ENDPOINT_DIRECTION_IN) { action = "interrupt read"; + // don't use a mutex here because a long time may elapse before getting a response + // and FIXME, not sure a mutex is required anyway for this action result = Libusb.usb_interrupt_read(handle,getEndpointAddress(),irp.getData(),timeout); } break; ! default : throw new RuntimeException("WindowsPipeOsImp.submitIrp: end point ("+epType+") type not (yet) supported!"); } Index: Mutex.java =================================================================== RCS file: /cvsroot/javax-usb/javax-usb-libusb/src/com/mcreations/usb/windows/Mutex.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Mutex.java 9 Jan 2006 21:12:37 -0000 1.1.1.1 --- Mutex.java 18 Aug 2008 18:14:52 -0000 1.2 *************** *** 80,90 **** { if (owner != Thread.currentThread()) ! throw new IllegalStateException( ! "Thread calling release() doesn't own mutex"); if (--lock_count <= 0) { owner = null; ! notify(); } } --- 80,91 ---- { if (owner != Thread.currentThread()) ! return; ! // throw new IllegalStateException( ! // "Thread calling release() doesn't own mutex"); if (--lock_count <= 0) { owner = null; ! notifyAll(); } } |
From: Mike C. <mc...@us...> - 2008-08-13 21:08:43
|
Update of /cvsroot/javax-usb/javax-usb-libusb/src/com/mcreations/usb/windows In directory sc8-pr-cvs17.sourceforge.net:/tmp/cvs-serv12844 Modified Files: JavaxUsb.java WindowsUsbServices.java Log Message: changed from indexes to Iterators to remove subtle errors with .remove Index: WindowsUsbServices.java =================================================================== RCS file: /cvsroot/javax-usb/javax-usb-libusb/src/com/mcreations/usb/windows/WindowsUsbServices.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** WindowsUsbServices.java 5 Aug 2008 16:26:52 -0000 1.2 --- WindowsUsbServices.java 13 Aug 2008 21:08:39 -0000 1.3 *************** *** 294,298 **** topologyListener.setName(threadName); ! // topologyListenerError = 0; topologyListener.start(); } --- 294,298 ---- topologyListener.setName(threadName); ! // topologyListenerError = 0; topologyListener.start(); } *************** *** 306,320 **** fillDeviceList(getRootUsbHubImp(),disconnectedDevices); ! disconnectedDevices.remove(getRootUsbHubImp()); ! // topologyUpdateResult = ! JavaxUsb.nativeTopologyUpdater(this, connectedDevices, disconnectedDevices); ! for (int i = 0; i < disconnectedDevices.size(); i++) ! ((UsbDeviceImp) disconnectedDevices.get(i)).disconnect(); ! for (int i = 0; i < connectedDevices.size(); i++) { ! UsbDeviceImp device = (UsbDeviceImp) connectedDevices.get(i); // fixme: setActiveConfig... is omitted to find out, whether it --- 306,326 ---- fillDeviceList(getRootUsbHubImp(),disconnectedDevices); ! while(disconnectedDevices.remove(getRootUsbHubImp())); ! JavaxUsb.nativeTopologyUpdater(this, connectedDevices, disconnectedDevices); ! Iterator iterator = disconnectedDevices.iterator(); ! while(iterator.hasNext()) ! { ! UsbDeviceImp device = (UsbDeviceImp) iterator.next(); ! if(log.isDebugEnabled()) log.debug( "updateTopology() disconnecting device: "+device ); ! device.disconnect(); ! listenerImp.usbDeviceDetached(new UsbServicesEvent(this, (UsbDevice)device )); ! } ! iterator = connectedDevices.iterator(); ! while(iterator.hasNext()) { ! UsbDeviceImp device = (UsbDeviceImp) iterator.next(); // fixme: setActiveConfig... is omitted to find out, whether it *************** *** 331,353 **** } ! for (int k = 0; k < connectedDevices.size(); k++) { ! /* Let's wait a bit before each new device's event, so its driver can have some time to ! * talk to it without interruptions. ! */ ! try ! { ! Thread.sleep(topologyUpdateNewDeviceDelay); ! } ! catch (InterruptedException iE) ! { ! } ! ! listenerImp.usbDeviceAttached(new UsbServicesEvent(this, (UsbDevice) connectedDevices.get(k))); } ! } ! for (int i = 0; i < disconnectedDevices.size(); i++) ! listenerImp.usbDeviceDetached(new UsbServicesEvent(this, (UsbDevice) disconnectedDevices.get(i))); synchronized (topologyLock) --- 337,353 ---- } ! // Let's wait a bit before each new device's event, so its driver can have some time to ! // talk to it without interruptions. FIXME, why is this delay here? ! try { ! Thread.sleep(topologyUpdateNewDeviceDelay); } ! catch (InterruptedException iE) ! { ! } ! if(log.isDebugEnabled()) log.debug( "updateTopology() connected device: "+device ); ! listenerImp.usbDeviceAttached(new UsbServicesEvent(this, (UsbDevice) device)); ! } synchronized (topologyLock) Index: JavaxUsb.java =================================================================== RCS file: /cvsroot/javax-usb/javax-usb-libusb/src/com/mcreations/usb/windows/JavaxUsb.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** JavaxUsb.java 5 Aug 2008 20:53:24 -0000 1.4 --- JavaxUsb.java 13 Aug 2008 21:08:39 -0000 1.5 *************** *** 37,40 **** --- 37,41 ---- import java.util.Hashtable; import java.util.List; + import java.util.Iterator; import javax.usb.UsbConst; *************** *** 799,806 **** // were present before (they are in disconnectedDevices) // are still present, now ! for (int i = 0; i < disconnectedDevices.size(); i++) { ! connectedDevices.add(disconnectedDevices.get(i)); ! disconnectedDevices.remove(i); } return 0; --- 800,808 ---- // were present before (they are in disconnectedDevices) // are still present, now ! Iterator iterator = disconnectedDevices.iterator(); ! while(iterator.hasNext()) { ! connectedDevices.add(iterator.next()); ! iterator.remove(); } return 0; |
From: Mike C. <mc...@us...> - 2008-08-07 14:35:22
|
Update of /cvsroot/javax-usb/javax-usb-libusb/src/com/mcreations/usb/windows In directory sc8-pr-cvs17.sourceforge.net:/tmp/cvs-serv350 Modified Files: WindowsDeviceOsImp.java Log Message: changed sendRequest so that set reports work by adding further checking on bmRequest. Also when sending a control out, the wLength arg is now correctly sent Index: WindowsDeviceOsImp.java =================================================================== RCS file: /cvsroot/javax-usb/javax-usb-libusb/src/com/mcreations/usb/windows/WindowsDeviceOsImp.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** WindowsDeviceOsImp.java 5 Aug 2008 16:26:51 -0000 1.2 --- WindowsDeviceOsImp.java 7 Aug 2008 14:35:10 -0000 1.3 *************** *** 18,21 **** --- 18,22 ---- import javax.usb.UsbDisconnectedException; import javax.usb.UsbException; + import javax.usb.util.UsbUtil; import net.sf.libusb.Libusb; *************** *** 129,134 **** throws UsbException { - if(log.isDebugEnabled())log.debug("syncSubmit() sending an irp" ); - sendRequest(irp); --- 130,133 ---- *************** *** 163,183 **** { // set configuration has its own libusb method ! if (cIrp.bRequest() == UsbConst.REQUEST_SET_CONFIGURATION) { ! Libusb.usb_set_configuration( ! getHandle(), ! cIrp.wValue()); ! return; } ! // FIXME timeout value hard-coded ! // int result = Libusb.usb_control_msg(handle,cIrp.bmRequestType(),cIrp.bRequest(), ! // cIrp.wValue(),cIrp.wIndex(),cIrp.getData(),5000); ! int result = Libusb.usb_control_msg(handle,cIrp.bmRequestType(),cIrp.bRequest(), ! cIrp.wValue(),cIrp.wIndex(),cIrp.getData(),JavaxUsb.getIoTimeout()); ! cIrp.setActualLength(result); ! if(log.isDebugEnabled()) log.debug( "sendRequest() Libusb.usb_control_msg returned "+result); } finally --- 162,201 ---- { // set configuration has its own libusb method ! if( (cIrp.bRequest() == UsbConst.REQUEST_SET_CONFIGURATION) && (cIrp.bmRequestType() ==0) ) { ! Libusb.usb_set_configuration( getHandle(),cIrp.wValue()); return; } ! byte[] data = cIrp.getData(); ! if( (cIrp.bmRequestType() & UsbConst.REQUESTTYPE_DIRECTION_MASK) == UsbConst.REQUESTTYPE_DIRECTION_OUT) ! { // this patch is needed because cIrp.wLength is not used as the argument to usb_control_msg ! // for reads, this is ok as the transfer size is governed by the device, ! // but when sending data a specific length needs to be send ! // FIXME - generate a rule in the SWIG processing to allow control of the length argument ! if(log.isDebugEnabled()) log.debug("sendRequest() direction OUT Len: "+cIrp.wLength()); ! byte[] data1 = cIrp.getData(); ! data = new byte[cIrp.wLength()]; ! for(int i =0;i<data.length;i++) ! { ! data[i]=data1[i]; ! } ! } + if(log.isDebugEnabled()) log.debug( "sendRequest() bmRequestType: "+UsbUtil.toHexString(cIrp.bmRequestType())+ + " bRequest: "+UsbUtil.toHexString(cIrp.bRequest())+ + " wValue: "+UsbUtil.toHexString(cIrp.wValue())+ + " wIndex: "+UsbUtil.toHexString(cIrp.wIndex())+ + " wLength: "+UsbUtil.toHexString(cIrp.wLength())); + + int result = Libusb.usb_control_msg(handle,cIrp.bmRequestType(),cIrp.bRequest(), cIrp.wValue(), cIrp.wIndex(),data ,JavaxUsb.getIoTimeout()); + if(result >=0) + cIrp.setActualLength(result); + else + { + String msg = "usb_control_msg: " + Libusb.usb_strerror() +" errorno: " + result; + log.debug(msg); + throw new UsbException(msg); + } } finally |
From: Mike C. <mc...@us...> - 2008-08-05 20:53:28
|
Update of /cvsroot/javax-usb/javax-usb-libusb/src/com/mcreations/usb/windows In directory sc8-pr-cvs17.sourceforge.net:/tmp/cvs-serv23092 Modified Files: JavaxUsb.java WindowsInterfaceOsImp.java Log Message: commented out unused variables and imports to get rid of warnings Index: WindowsInterfaceOsImp.java =================================================================== RCS file: /cvsroot/javax-usb/javax-usb-libusb/src/com/mcreations/usb/windows/WindowsInterfaceOsImp.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** WindowsInterfaceOsImp.java 5 Aug 2008 16:26:51 -0000 1.2 --- WindowsInterfaceOsImp.java 5 Aug 2008 20:53:24 -0000 1.3 *************** *** 28,32 **** //import javax.usb.UsbDevice; import net.sf.libusb.usb_config_descriptor; ! import net.sf.libusb.usb_device; /** --- 28,32 ---- //import javax.usb.UsbDevice; import net.sf.libusb.usb_config_descriptor; ! //import net.sf.libusb.usb_device; /** Index: JavaxUsb.java =================================================================== RCS file: /cvsroot/javax-usb/javax-usb-libusb/src/com/mcreations/usb/windows/JavaxUsb.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** JavaxUsb.java 5 Aug 2008 20:40:32 -0000 1.3 --- JavaxUsb.java 5 Aug 2008 20:53:24 -0000 1.4 *************** *** 372,376 **** { log(LOG_HOTPLUG, FUNC, CLASS, "loadLibrary", "Getting java.library.path"); ! String temp = "java.library.path="+System.getProperty("java.library.path"); // System.out.println("java.library.path="+System.getProperty("java.library.path")); --- 372,376 ---- { log(LOG_HOTPLUG, FUNC, CLASS, "loadLibrary", "Getting java.library.path"); ! // String temp = "java.library.path="+System.getProperty("java.library.path"); // System.out.println("java.library.path="+System.getProperty("java.library.path")); |
From: Mike C. <mc...@us...> - 2008-08-05 20:41:03
|
Update of /cvsroot/javax-usb/javax-usb-libusb/swig In directory sc8-pr-cvs17.sourceforge.net:/tmp/cvs-serv17328/swig Modified Files: makefile Log Message: changed name of jni library to usbJNI.dll to make it consitant with linux version Index: makefile =================================================================== RCS file: /cvsroot/javax-usb/javax-usb-libusb/swig/makefile,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** makefile 5 Aug 2008 20:07:32 -0000 1.3 --- makefile 5 Aug 2008 20:40:28 -0000 1.4 *************** *** 8,12 **** LIBUSB_PATH = ../../libusb-win32-device-bin-0.1.12.1 C_OPTIONS = -mno-cygwin ! JNI_DLL = LibusbJNI.dll INCLUDE = -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/win32 -I$(LIBUSB_PATH)/include LINK_OPTIONS = -Wl,--kill-at -mno-cygwin --- 8,12 ---- LIBUSB_PATH = ../../libusb-win32-device-bin-0.1.12.1 C_OPTIONS = -mno-cygwin ! JNI_DLL = usbJNI.dll INCLUDE = -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/win32 -I$(LIBUSB_PATH)/include LINK_OPTIONS = -Wl,--kill-at -mno-cygwin *************** *** 22,26 **** endif ! IFILE = Libusb INTERFACE = $(IFILE).i WRAPFILE = $(IFILE)_wrap --- 22,26 ---- endif ! IFILE = libusb INTERFACE = $(IFILE).i WRAPFILE = $(IFILE)_wrap |
From: Mike C. <mc...@us...> - 2008-08-05 20:40:35
|
Update of /cvsroot/javax-usb/javax-usb-libusb/src/com/mcreations/usb/windows In directory sc8-pr-cvs17.sourceforge.net:/tmp/cvs-serv17328/src/com/mcreations/usb/windows Modified Files: JavaxUsb.java Log Message: changed name of jni library to usbJNI.dll to make it consitant with linux version Index: JavaxUsb.java =================================================================== RCS file: /cvsroot/javax-usb/javax-usb-libusb/src/com/mcreations/usb/windows/JavaxUsb.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** JavaxUsb.java 5 Aug 2008 16:26:51 -0000 1.2 --- JavaxUsb.java 5 Aug 2008 20:40:32 -0000 1.3 *************** *** 1148,1153 **** //************************************************************************* // Class constants ! public static final String LIBRARY_NAME = "LibusbJNI"; ! // public static final String LIBRARY_NAME = "usbJNI"; public static final String ERROR_WHILE_LOADING_SHARED_LIBRARY = "Error while loading shared library"; public static final String EXCEPTION_WHILE_LOADING_SHARED_LIBRARY = "Exception while loading shared library"; --- 1148,1153 ---- //************************************************************************* // Class constants ! // public static final String LIBRARY_NAME = "LibusbJNI"; ! public static final String LIBRARY_NAME = "usbJNI"; public static final String ERROR_WHILE_LOADING_SHARED_LIBRARY = "Error while loading shared library"; public static final String EXCEPTION_WHILE_LOADING_SHARED_LIBRARY = "Exception while loading shared library"; |
From: Mike C. <mc...@us...> - 2008-08-05 20:40:34
|
Update of /cvsroot/javax-usb/javax-usb-libusb/lib In directory sc8-pr-cvs17.sourceforge.net:/tmp/cvs-serv17328/lib Added Files: usbJNI.dll Removed Files: LibusbJNI.dll Log Message: changed name of jni library to usbJNI.dll to make it consitant with linux version --- LibusbJNI.dll DELETED --- --- NEW FILE: usbJNI.dll --- (This appears to be a binary file; contents omitted.) |
From: Mike C. <mc...@us...> - 2008-08-05 20:07:46
|
Update of /cvsroot/javax-usb/javax-usb-libusb/swig In directory sc8-pr-cvs17.sourceforge.net:/tmp/cvs-serv2966/swig Modified Files: makefile Log Message: changes that make it easier to switch from windows to linux implementations of libusb Index: makefile =================================================================== RCS file: /cvsroot/javax-usb/javax-usb-libusb/swig/makefile,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** makefile 5 Aug 2008 15:23:56 -0000 1.2 --- makefile 5 Aug 2008 20:07:32 -0000 1.3 *************** *** 1,28 **** # Copyright (c) 2005 m-creations gmbh http://www.m-creations.com # - # - JAVA_HOME should point to your jdk - # - location of SWIG should be corrected SWIG = /cygdrive/c/usr/bin/swigwin-1.3.36/swig.exe - JAVA_HOME = /cygdrive/c/Program\ Files/Java/jdk1.6.0_07 IFILE = Libusb INTERFACE = $(IFILE).i WRAPFILE = $(IFILE)_wrap - CC = gcc - SWIG_DEST = ../src/net/sf/libusb - LIBUSB_PATH = ../../libusb-win32-device-bin-0.1.12.1 - INCLUDE = -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/win32 -I$(LIBUSB_PATH)/include - JNI_DLL = LibusbJNI.dll java:: $(SWIG) -package net.sf.libusb -I${INCLUDE} -v -Wall -java -o $(WRAPFILE).c $(INTERFACE) ! $(CC) -c -mno-cygwin -shared $(INCLUDE) $(WRAPFILE).c -o $(WRAPFILE).o ! $(CC) -shared $(WRAPFILE).o -o $(JNI_DLL) -L$(LIBUSB_PATH)/lib/gcc -lusb -Wl,--kill-at -mno-cygwin ! chmod 666 $(WRAPFILE).c chmod 777 $(JNI_DLL) mv $(JNI_DLL) ../lib/ --- 1,40 ---- + # Copyright (c) 2008 Gulf Coast Data Concepts http://www.gcdataconcepts.com # Copyright (c) 2005 m-creations gmbh http://www.m-creations.com # + ifdef CYGWIN SWIG = /cygdrive/c/usr/bin/swigwin-1.3.36/swig.exe JAVA_HOME = /cygdrive/c/Program\ Files/Java/jdk1.6.0_07 + LIBUSB_PATH = ../../libusb-win32-device-bin-0.1.12.1 + C_OPTIONS = -mno-cygwin + JNI_DLL = LibusbJNI.dll + INCLUDE = -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/win32 -I$(LIBUSB_PATH)/include + LINK_OPTIONS = -Wl,--kill-at -mno-cygwin + else + # swig doesn't work with version 1.3.31, works with version 1.3.36 + SWIG = /usr/local/bin/swig + JAVA_HOME = /usr/local/jdk1.6.0_04 + LIBUSB_PATH = /usr + C_OPTIONS = + JNI_DLL = libusbJNI.so + INCLUDE = -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux -I$(LIBUSB_PATH)/include + LINK_OPTINS = + endif IFILE = Libusb INTERFACE = $(IFILE).i WRAPFILE = $(IFILE)_wrap CC = gcc SWIG_DEST = ../src/net/sf/libusb java:: + ifdef CYGWIN + echo "compiling for CYGWIN target" + endif $(SWIG) -package net.sf.libusb -I${INCLUDE} -v -Wall -java -o $(WRAPFILE).c $(INTERFACE) ! $(CC) -c $(C_OPTIONS) -shared $(INCLUDE) $(WRAPFILE).c -o $(WRAPFILE).o ! $(CC) -shared $(WRAPFILE).o -o $(JNI_DLL) -L$(LIBUSB_PATH)/lib/gcc -lusb $(LINK_OPTIONS) ! rm $(WRAPFILE).c chmod 777 $(JNI_DLL) mv $(JNI_DLL) ../lib/ |
From: Mike C. <mc...@us...> - 2008-08-05 20:07:45
|
Update of /cvsroot/javax-usb/javax-usb-libusb/lib In directory sc8-pr-cvs17.sourceforge.net:/tmp/cvs-serv2966/lib Modified Files: LibusbJNI.dll MANIFEST.MF jsr80_windows.jar Log Message: changes that make it easier to switch from windows to linux implementations of libusb Index: MANIFEST.MF =================================================================== RCS file: /cvsroot/javax-usb/javax-usb-libusb/lib/MANIFEST.MF,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MANIFEST.MF 5 Aug 2008 15:33:41 -0000 1.2 --- MANIFEST.MF 5 Aug 2008 20:07:40 -0000 1.3 *************** *** 4,8 **** Built-By: Mike Implementation-Title: javax.usb Windows Implementation ! Implementation-Version: 0.9.0 2008-07-30 16:19 Implementation-Vendor: m-creations gmbh Class-Path: jsr80.jar jsr80_ri.jar commons-logging.jar log4j.jar --- 4,8 ---- Built-By: Mike Implementation-Title: javax.usb Windows Implementation ! Implementation-Version: 0.9.0 2008-08-05 12:52 Implementation-Vendor: m-creations gmbh Class-Path: jsr80.jar jsr80_ri.jar commons-logging.jar log4j.jar Index: jsr80_windows.jar =================================================================== RCS file: /cvsroot/javax-usb/javax-usb-libusb/lib/jsr80_windows.jar,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 Binary files /tmp/cvsu6idVN and /tmp/cvs8BWVr4 differ Index: LibusbJNI.dll =================================================================== RCS file: /cvsroot/javax-usb/javax-usb-libusb/lib/LibusbJNI.dll,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 Binary files /tmp/cvspUtth4 and /tmp/cvsUZ6ykl differ |
From: Mike C. <mc...@us...> - 2008-08-05 20:07:44
|
Update of /cvsroot/javax-usb/javax-usb-libusb In directory sc8-pr-cvs17.sourceforge.net:/tmp/cvs-serv2966 Modified Files: build.xml Log Message: changes that make it easier to switch from windows to linux implementations of libusb Index: build.xml =================================================================== RCS file: /cvsroot/javax-usb/javax-usb-libusb/build.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** build.xml 5 Aug 2008 16:33:41 -0000 1.2 --- build.xml 5 Aug 2008 20:07:39 -0000 1.3 *************** *** 2,5 **** --- 2,6 ---- <!-- JSR80 Windows Implementation --> <!-- + * Copyright (c) 2008 mcrowe GCDC LLC * Copyright (c) 2005 m-creations GmbH * Copyright (c) 2003 Dan Streetman (dds...@ie...) *************** *** 17,21 **** <!-- Note these depend on ANT not overwriting preset variables --> <property environment="Jsr80Env"/> ! <property name="Jsr80Env.JSR80_RI_BASE_DIR" value="../javax-usb-ri"/> <property name="Jsr80Env.JSR80_BASE_DIR" value="../javax-usb"/> <property name="Jsr80Env.JSR80_WINDOWS_JARFILE" value="jsr80_windows.jar"/> <property name="Jsr80Env.JSR80_WINDOWS_SRC_DIR" value="src"/> --- 18,25 ---- <!-- Note these depend on ANT not overwriting preset variables --> <property environment="Jsr80Env"/> ! ! <property name="Jsr80Env.JSR80_RI_BASE_DIR" value="./"/> ! <property name="Jsr80Env.JSR80_BASE_DIR" value="./"/> ! <property name="Jsr80Env.JSR80_WINDOWS_JARFILE" value="jsr80_windows.jar"/> <property name="Jsr80Env.JSR80_WINDOWS_SRC_DIR" value="src"/> *************** *** 80,83 **** --- 84,89 ---- <property name="jsr80.windows.jdoc.private" value="no"/> + <property name="jsr80_ri.jar.available" value="no"/> + <property name="jsr80.windows.jdoc.path" value="${Jsr80Env.JSR80_WINDOWS_JDOC_PATH}"/> *************** *** 99,103 **** <!-- clean, compile, jars, jdoc --> <target name="all" depends="clean,compile,jars,jdoc"/> ! <!-- build the jsr80.jar, if not available by calling its build.xml --> <target name="jar-ri" unless="jsr80_ri.jar.available"> <echo message="Building jsr80_ri.jar first."/> <ant antfile="${Jsr80Env.JSR80_RI_BASE_DIR}/build.xml" target="jars" /> </target> <!-- Compile classfiles and create the native library --> <target name="compile"> --- 105,113 ---- <!-- clean, compile, jars, jdoc --> <target name="all" depends="clean,compile,jars,jdoc"/> ! <!-- build the jsr80.jar, if not available by calling its build.xml --> ! <target name="jar-ri" unless="jsr80_ri.jar.available"> ! <echo message="Building jsr80_ri.jar first."/> ! <ant antfile="${Jsr80Env.JSR80_RI_BASE_DIR}/build.xml" target="jars" /> ! </target> <!-- Compile classfiles and create the native library --> <target name="compile"> |
From: Mike C. <mc...@us...> - 2008-08-05 16:34:31
|
Update of /cvsroot/javax-usb/javax-usb-libusb In directory sc8-pr-cvs17.sourceforge.net:/tmp/cvs-serv31484 Modified Files: README.txt Log Message: notes from this round of changes (July/August 2008) Index: README.txt =================================================================== RCS file: /cvsroot/javax-usb/javax-usb-libusb/README.txt,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** README.txt 9 Jan 2006 21:11:45 -0000 1.1.1.1 --- README.txt 5 Aug 2008 16:34:23 -0000 1.2 *************** *** 2,5 **** --- 2,69 ---- ============================ + Code status: development + Todo + isocronous data transfer + TESTING, TESTING, TESTING + install package for end users and application developers + + Author: Mike Crowe (mcrowe at gcdataconcepts dot com) + Last modification: 2008-Jul-30 + Updated code to use latest release of libusb-win32, (libusb-win32-device-bin-0.1.12.1). + Get Reports now work through syncSubmit and UsbControlIrps. Interrupt in data flow working. + It appears that Kambiz had bulk tranfers working, but I am unclear as to the exact status. + Support still lacking for isocronous data tranfer. Brought up to date to use cvs release + which is at least version 1.0.2 for javax.usb and 1.0.2 for javax.usb.ri. + Tested against usb-accelerometer (see http://www.gcdataconcepts.com for details) + which supports get and set reports as well as interrupt driven in data. + + How to compile this code + install cygwin on a Windows computer + use cygwin setup to install the following + swig + gcc + binutils + make + cvs + ssh (if you'd like to work remotely) + + install a java development kit. I used jdk1.6.0_07, but other versions + should work as well. + + install libusb-win32 see http://libusb-win32.sourceforge.net/ + + install apache-ant (http://ant.apache.org/) + + + I commented out part of usb.h (part of libusb-win32) dealing with windows specific components of the + dll, but this is probably unnessisary + + + To build, start with the swig directory. You will probably have to adjust + some paths to get it to compile properly. When it compiles properly you + should hav a LibusbJNK.dll file in the ./lib directory and a number of .java + files in ./src/net/sf/libusb directory. When you have this, the native + interface is complete and it's time to build the .jar file + + I used ant from apache like this to make jars but had to export JAVA_HOME + first + + export JAVA_HOME=`cygpath -wp /cygdrive/c/Program\ Files/Java/jdk1.6.0_07/` + + /path/to/ant/apache-ant-1.7.1-bin/apache-ant-1.7.1/bin/ant.bat jars + + Once you have the jsr80_windows.jar file you are ready to test the + installation. + + As part of testing Kamiz used log4j.jar and commons-loggin.jar for + diagnostics. It works well, but if you don't use it, that's ok. The + interface will report that it's missing and continue on without it. + + Testing + OK puff, puff puff. That was alot of pain. Now comes the hard part, + testing. I used my target hardware (http://www.gcdataconcepts.com/xlr8r-1.html) + for testing. You will need to find your own device. + + Author: Kambiz Darabi (darabi at m-creations dot com) Last modification: 2005-08-22 *************** *** 59,64 **** ! Requirements ! ============ --- 123,128 ---- ! Build Requirements ! ================== |
From: Mike C. <mc...@us...> - 2008-08-05 16:33:47
|
Update of /cvsroot/javax-usb/javax-usb-libusb In directory sc8-pr-cvs17.sourceforge.net:/tmp/cvs-serv30994 Modified Files: build.xml Log Message: better clean target, new path elements to use ./lib location better Index: build.xml =================================================================== RCS file: /cvsroot/javax-usb/javax-usb-libusb/build.xml,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** build.xml 9 Jan 2006 21:11:45 -0000 1.1.1.1 --- build.xml 5 Aug 2008 16:33:41 -0000 1.2 *************** *** 102,106 **** <!-- Compile classfiles and create the native library --> <target name="compile"> ! <available file="${Jsr80Env.JSR80_RI_BASE_DIR}/lib/jsr80_ri.jar" property="jsr80_ri.jar.available" value="true" /> <antcall target="jar-ri" /> <echo message="Compiling class files."/> <mkdir dir="${jsr80.windows.dest.dir}"/> <javac --- 102,111 ---- <!-- Compile classfiles and create the native library --> <target name="compile"> ! <available ! file="${Jsr80Env.JSR80_RI_BASE_DIR}/lib/jsr80_ri.jar" ! property="jsr80_ri.jar.available" ! value="true"/> ! <antcall target="jar-ri" /> ! <echo message="Compiling class files."/> <mkdir dir="${jsr80.windows.dest.dir}"/> <javac *************** *** 111,118 **** deprecation="${jsr80.windows.deprecation}" verbose="${jsr80.windows.verbose}" ! failonerror="yes"> <classpath> <pathelement location="${Jsr80Env.JSR80_RI_BASE_DIR}/lib/jsr80_ri.jar"/> <pathelement location="${Jsr80Env.JSR80_BASE_DIR}/lib/jsr80.jar"/> </classpath> </javac> <!-- <exec executable="build" dir="${jsr80.windows.jni.src.dir}" failonerror="yes"> ! </exec> --> </target> --- 116,130 ---- deprecation="${jsr80.windows.deprecation}" verbose="${jsr80.windows.verbose}" ! failonerror="yes"> ! <classpath> ! <pathelement location="./lib/commons-logging.jar"/> ! <pathelement location="./lib/log4j.jar"/> ! <pathelement location="${Jsr80Env.JSR80_RI_BASE_DIR}/lib/jsr80_ri.jar"/> ! <pathelement location="${Jsr80Env.JSR80_BASE_DIR}/lib/jsr80.jar"/> ! </classpath> ! </javac> <!-- <exec executable="build" dir="${jsr80.windows.jni.src.dir}" failonerror="yes"> ! </exec> --> </target> *************** *** 199,204 **** <target name="clean"> <echo message="Cleaning everything."/> ! <delete verbose="${jsr80.windows.verbose}" quiet="${jsr80.windows.quiet}" failonerror="false"> ! <fileset dir="${jsr80.windows.dest.dir}" includes="com/ibm/jusb/**/*.class"/> <fileset dir="${jsr80.windows.jarfile.dir}" includes="${jsr80.windows.jarfile}"/> <fileset dir="${jsr80.windows.jni.dest.dir}" includes="${jsr80.windows.jni.library}"/> --- 211,218 ---- <target name="clean"> <echo message="Cleaning everything."/> ! <!-- <defaultexcludes echo="true"/> --> ! <delete verbose="${jsr80.windows.verbose}" quiet="${jsr80.windows.quiet}" failonerror="true"> ! <fileset dir="." defaultexcludes="false" includes="**/*~"/> ! <fileset dir="${jsr80.windows.dest.dir}" includes="**/*.class"/> <fileset dir="${jsr80.windows.jarfile.dir}" includes="${jsr80.windows.jarfile}"/> <fileset dir="${jsr80.windows.jni.dest.dir}" includes="${jsr80.windows.jni.library}"/> |
From: Mike C. <mc...@us...> - 2008-08-05 16:30:54
|
Update of /cvsroot/javax-usb/javax-usb-libusb/lib In directory sc8-pr-cvs17.sourceforge.net:/tmp/cvs-serv29277 Modified Files: javax.usb.properties Log Message: decreased delay when using with linux system as libusb sees the entire bus rather than with the windows implemntation which only sees selected interfaces Index: javax.usb.properties =================================================================== RCS file: /cvsroot/javax-usb/javax-usb-libusb/lib/javax.usb.properties,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** javax.usb.properties 9 Jan 2006 21:11:55 -0000 1.1.1.1 --- javax.usb.properties 5 Aug 2008 16:30:50 -0000 1.2 *************** *** 18,22 **** # milliseconds between two polls of the usb bus ! com.ibm.jusb.os.windows.WindowsUsbServices.topologyUpdateDelay=5000 com.ibm.jusb.os.windows.WindowsUsbServices.JNI.trace_level=5 --- 18,23 ---- # milliseconds between two polls of the usb bus ! #com.ibm.jusb.os.windows.WindowsUsbServices.topologyUpdateDelay=5000 ! com.ibm.jusb.os.windows.WindowsUsbServices.topologyUpdateDelay=100 com.ibm.jusb.os.windows.WindowsUsbServices.JNI.trace_level=5 |