In my program I fetch the Device using the Device dd1 = USB.getDevice(dd.getIdVendor(), dd.getIdProduct()). I am able to get the device but when I
do a device.open() it gives me an error. The Device.open() API expects 3 parameters which are the configuration number (I dont know whether it is
the bConfigurationValue or the iConfiguration) then the Interface number and finally the alternate interface number.
If I make a call as device.open(1,0,0) then I get the following error
ch.ntb.usb.USBException: LibusbJava.usb_set_configuration: usb_set_configuration: could not set config 1: win error: Data error (cyclic redundancy
check).
If I make a call as device.open(0,0,0) then I get the following error
ch.ntb.usb.USBException: LibusbJava.usb_claim_interface: usb_claim_interface: could not claim interface 0, invalid configuration 0
I even get to see the same error (could not set config 1: win error: Data error (cyclic redundancy check).) with the sample code provided (UsbView,
TestApp). Can inputs will indeed be of great help to me as I am stucked up out here. Please do help me in this regards as I need to build the
application in urgent. Many thanks in advance
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
From your device descriptor I would expect it to work with:
- configuration: iConfiguration + 1 => 1
- interface: iInterface => 4, 5, 6
- altinterface: bAlternateSetting => 0
e.g. device.open(1,4,0)
Ranges
1 <= configuration <= n
0 <= interface <= n
-1 <= altinterface <= n
Note that -1 for altinterface doesn't set the alternative interface (LibusbJava.usb_set_altinterface).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello Spandi Thanks a lot for throwing some light on this issue. However after changing my code to the following i.e. device.open(1,4,0) I still get the same error. Can you please clarify one more query i.e. when we run the testlibusb program is it always the iInterface number that I need to look for or the bInterface number? What is the difference between these two? I am still now able to run my code. Following is the error that I am getting
Manufacturer Name: Royal Philips Electronics
Product Name: Reference Design Philips Semiconductors
vendor id: 1137
prod id: 4609
ch.ntb.usb.USBException: LibusbJava.usb_set_configuration: usb_set_configuration: could not set config 1: win error: Data error (cyclic redundancy check).
at ch.ntb.usb.Device.claim_interface(Device.java:590)
at ch.ntb.usb.Device.open(Device.java:197)
at com.sripaisit.USB.TestLibUsbJava.<init>(TestLibUsbJava.java:26)
at com.sripaisit.USB.TestLibUsbJava.main(TestLibUsbJava.java:37)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Sorry in my previous post I mentioned that I am still now able to run my code which is not true. Actually I intended to write it as I am still not able to run my code. Please techies I desperately need your help on this issue
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
My last post was mixing up the i and b values. So here is a complete (and correct) example. Also check the Java doc on the getters of the corresponding Java classes (e.g. Usb_Config_Descriptor, Usb_Interface_Descriptor, ...)
Lets have a look at this descriptor of a Logitech Mouse:
Dev #1: Logitech - Optical USB Mouse
-> Configuration Descriptor <-
wTotalLength: 34
bNumInterfaces: 1
bConfigurationValue: 1 <- value to use as an argument to select this configuration
iConfiguration: 0
bmAttributes: a0h
MaxPower: 50
-> Interface Descriptor <-
bInterfaceNumber: 0 <- number (identifier) of this interface
bAlternateSetting: 0 <- value used to select the alternate setting
bNumEndpoints: 1
bInterfaceClass: 3
bInterfaceSubClass: 1
bInterfaceProtocol: 2
iInterface: 0
-> Endpoint Descriptor <-
bEndpointAddress: 81h
bmAttributes: 03h
wMaxPacketSize: 4
bInterval: 10
bRefresh: 0
bSynchAddress: 0
So we have device.open(bConfigurationValue, bInterfaceNumber, bAlternateSetting) witch gives device.open(1, 0, 0) for this device.
About the CRC-error: This is probably the real problem, but I looks more like an issue with the device. Are you sure the device is working with its standard driver?
You may get some more help on this issue on the libusb or libusb-win32 mailing list (LibusbJava just uses this libraries and the error you see is from libusb-win32).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for the information, however the device driver that come along with this USB Modem is already installed on my laptop and its working fine no probs with it. but when I try to use it with my program it throws up the error.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello techies,
I am new to this Lib Java USB API. I want to send some "AT" Commands to an USB GSM/GPRS Modem. I am able to get the vendor id, product id
and I am also able to display the manufacturer' name and the product name. How can i fetch the active configuration details of my device. When I
execute the Libwinusb32 test program I get the following output
<output>
DLL version: 0.1.12.1
Driver version: 0.1.12.1
bus/device idVendor/idProduct
bus-0/\\.\libusb0-0001--0x0471-0x1201 0471/1201
- Manufacturer : Royal Philips Electronics
- Product : Reference Design Philips Semiconductors
- Serial Number: 000000-00-000000
wTotalLength: 92
bNumInterfaces: 3
bConfigurationValue: 1
iConfiguration: 0
bmAttributes: c0h
MaxPower: 250
bInterfaceNumber: 0
bAlternateSetting: 0
bNumEndpoints: 0
bInterfaceClass: 2
bInterfaceSubClass: 8
bInterfaceProtocol: 0
iInterface: 4
bInterfaceNumber: 1
bAlternateSetting: 0
bNumEndpoints: 1
bInterfaceClass: 2
bInterfaceSubClass: 2
bInterfaceProtocol: 1
iInterface: 5
bEndpointAddress: 81h
bmAttributes: 03h
wMaxPacketSize: 16
bInterval: 16
bRefresh: 0
bSynchAddress: 0
bInterfaceNumber: 2
bAlternateSetting: 0
bNumEndpoints: 2
bInterfaceClass: 10
bInterfaceSubClass: 0
bInterfaceProtocol: 0
iInterface: 6
bEndpointAddress: 03h
bmAttributes: 02h
wMaxPacketSize: 64
bInterval: 0
bRefresh: 0
bSynchAddress: 0
bEndpointAddress: 83h
bmAttributes: 02h
wMaxPacketSize: 64
bInterval: 0
bRefresh: 0
bSynchAddress: 0
</output>
In my program I fetch the Device using the Device dd1 = USB.getDevice(dd.getIdVendor(), dd.getIdProduct()). I am able to get the device but when I
do a device.open() it gives me an error. The Device.open() API expects 3 parameters which are the configuration number (I dont know whether it is
the bConfigurationValue or the iConfiguration) then the Interface number and finally the alternate interface number.
If I make a call as device.open(1,0,0) then I get the following error
ch.ntb.usb.USBException: LibusbJava.usb_set_configuration: usb_set_configuration: could not set config 1: win error: Data error (cyclic redundancy
check).
If I make a call as device.open(0,0,0) then I get the following error
ch.ntb.usb.USBException: LibusbJava.usb_claim_interface: usb_claim_interface: could not claim interface 0, invalid configuration 0
I even get to see the same error (could not set config 1: win error: Data error (cyclic redundancy check).) with the sample code provided (UsbView,
TestApp). Can inputs will indeed be of great help to me as I am stucked up out here. Please do help me in this regards as I need to build the
application in urgent. Many thanks in advance
From your device descriptor I would expect it to work with:
- configuration: iConfiguration + 1 => 1
- interface: iInterface => 4, 5, 6
- altinterface: bAlternateSetting => 0
e.g. device.open(1,4,0)
Ranges
1 <= configuration <= n
0 <= interface <= n
-1 <= altinterface <= n
Note that -1 for altinterface doesn't set the alternative interface (LibusbJava.usb_set_altinterface).
Hello Spandi Thanks a lot for throwing some light on this issue. However after changing my code to the following i.e. device.open(1,4,0) I still get the same error. Can you please clarify one more query i.e. when we run the testlibusb program is it always the iInterface number that I need to look for or the bInterface number? What is the difference between these two? I am still now able to run my code. Following is the error that I am getting
Manufacturer Name: Royal Philips Electronics
Product Name: Reference Design Philips Semiconductors
vendor id: 1137
prod id: 4609
ch.ntb.usb.USBException: LibusbJava.usb_set_configuration: usb_set_configuration: could not set config 1: win error: Data error (cyclic redundancy check).
at ch.ntb.usb.Device.claim_interface(Device.java:590)
at ch.ntb.usb.Device.open(Device.java:197)
at com.sripaisit.USB.TestLibUsbJava.<init>(TestLibUsbJava.java:26)
at com.sripaisit.USB.TestLibUsbJava.main(TestLibUsbJava.java:37)
Sorry in my previous post I mentioned that I am still now able to run my code which is not true. Actually I intended to write it as I am still not able to run my code. Please techies I desperately need your help on this issue
My last post was mixing up the i and b values. So here is a complete (and correct) example. Also check the Java doc on the getters of the corresponding Java classes (e.g. Usb_Config_Descriptor, Usb_Interface_Descriptor, ...)
Lets have a look at this descriptor of a Logitech Mouse:
Dev #1: Logitech - Optical USB Mouse
-> Configuration Descriptor <-
wTotalLength: 34
bNumInterfaces: 1
bConfigurationValue: 1 <- value to use as an argument to select this configuration
iConfiguration: 0
bmAttributes: a0h
MaxPower: 50
-> Interface Descriptor <-
bInterfaceNumber: 0 <- number (identifier) of this interface
bAlternateSetting: 0 <- value used to select the alternate setting
bNumEndpoints: 1
bInterfaceClass: 3
bInterfaceSubClass: 1
bInterfaceProtocol: 2
iInterface: 0
-> Endpoint Descriptor <-
bEndpointAddress: 81h
bmAttributes: 03h
wMaxPacketSize: 4
bInterval: 10
bRefresh: 0
bSynchAddress: 0
So we have device.open(bConfigurationValue, bInterfaceNumber, bAlternateSetting) witch gives device.open(1, 0, 0) for this device.
About the CRC-error: This is probably the real problem, but I looks more like an issue with the device. Are you sure the device is working with its standard driver?
You may get some more help on this issue on the libusb or libusb-win32 mailing list (LibusbJava just uses this libraries and the error you see is from libusb-win32).
Hello Spandi,
Thanks for the information, however the device driver that come along with this USB Modem is already installed on my laptop and its working fine no probs with it. but when I try to use it with my program it throws up the error.