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( ! ... [truncated message content] |