#3 How to get Active USB Configuration?

open
nobody
None
5
2012-12-06
2008-11-19
Anonymous
No

Hello Techies,
I am new to this Java Lib USB package. I have a USB GSM/GPRS Modem and I want to send "AT" commands to that modem (Modem suports AT Commands). In my Java Program i am able to see the Modem's Manufacturer name and the product Name. Now I want to send some "AT" Commands to this modem but firstly I need to get the Active USB Configuration which I am not able to do so. If i run the libusb-win32 test program then 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>

I am able to fetch the device using the following
Device dd1 = USB.getDevice(dd.getIdVendor(), dd.getIdProduct());

However when I try using the open function (dd1.open(1,0,0)) then it throws 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).

the open() function accepts 3 parameters viz configuration number, interface number, alternate interface number. If i give the configuration number as 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

Can anyone of you please put some light as to where am I going wrong? Its of urgent need as I need to develop this application faster. Any inputs will surely be of great help to me. Many Thanks in advance. Please help me

Discussion