hi,
I am just 1 week conversant with usb and dont know much details. I am
writing a program to communicate with GSM modem connected to PC with
USB cable.
No matter which AT command i send to my gsm modem, it returns the same
2 byte response to me. Response is 1` (0x31 0x60).
_SETUP_
0. Intel x686 m/c.
1. Suse Linux 9.0. Kernel 2.4.16
2. Falcom (Seimens MC35) GSM modem with usb cable.
3. UHCI controller.
4. /proc/bus/usb/devices shows my device with correct details.
5. I have been able to print my complete usb topology which shows that
i have IN and OUT endpoints with BULK type.[maxpktsize = 64]
My Code to submit data and get response (exceptions and log stmts removed)
public String submitData(byte[] reqData){
UsbIrp irp = outPipe.createUsbIrp(); // outPipe means host to device
irp.setData(irp);
outPipe.syncSubmit(irp);
if(1 > irp.getActualLength())
throw new UsbCommException("packet sending failed");
else
{
Thread.sleep(1000);
byte[] resData = new byte[540];
UsbIrp inIrp = inPipe.createUsbIrp();
inIrp.setData(resData);
int totalBytes = 0;
int bytesRead = 0;
do{
inPipe.syncSubmit(inIrp);
bytesRead = inIrp.getActualLength();
totalBytes += bytesRead;
} while(!inIrp.isComplete())
}
return new String(resdata,0,totalBytes);
}
Is this method correct to send and receive data from usb device?
Now, if i send whatever reqData. (I tried sending ATZ, AT&F, AT,
AT+CPIN=?), this method always returns same 2 byte response i.e 0x31
0x60.
What's wrong here? Please help. Any comments will be helpful.
regards
Navjot Singh
-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
_______________________________________________
javax-usb-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/javax-usb-devel