|
From: Carlos J M. <car...@in...> - 2004-11-18 15:52:47
|
Hi All,
I am new about programming for USB. I am trying to start a communication with a Sony Ericsson mobile
phone.
I have got success return from usb_bulk_write() , but not from usb_bulk_read().
Could anyone help me ? Any information is important.
I am sending my output from usbview and a piece of code.
usbview output: =========================================
Sony Ericsson V800-Vodafone 802SE
Manufacturer: Sony Ericsson
Serial Number: 004601015057343_0
Speed: 12Mb/s (full)
USB Version: 2.00
Device Class: 02(comm.)
Device Subclass: 00
Device Protocol: 00
Maximum Default Endpoint Size: 64
Number of Configurations: 1
Vendor Id: 0fce
Product Id: d008
Revision Number: 0.00
Interface Number: 2
Name: (none)
Alternate Number: 0
Class: 0a(data )
Sub Class: 0
Protocol: 0
Number of Endpoints: 2
Endpoint Address: 02
Direction: out
Attribute: 2
Type: Bulk
Max Packet Size: 64
Interval: 0ms
Endpoint Address: 82
Direction: in
Attribute: 2
Type: Bulk
Max Packet Size: 64
Interval: 0ms
my code : ==============================================================================
#define END_POINT_IN 0x02
#define END_POINT_OUT 0x82
/* this is a Obex setpath message */
unsigned char buffer[] = {
0x80, 0x00, 0x1a, 0x10, 0x00, 0x02, 0x00, 0x46, 0x00,0x13, 0xf9, 0xec, 0x7b, 0xc4,
0x95 , 0x3c, 0x11, 0xd2, 0x98, 0x4e, 0x52, 0x54, 0x00, 0xdc, 0x9e, 0x09
};
unsigned char rec[128];
if ( (usbHandle = usb_open( dev ) ) )
{
int ret;
ret = usb_set_configuration( usbHandle, 1 );
ret = usb_claim_interface( usbHandle, 2 );
if ( ret < 0 )
{
printf("\n\nusb_claim_interface ERROR:\n\n\n");
return;
}
ret = usb_bulk_write(usbHandle, END_POINT_OUT, "\r\r\rATZ\r" , 7, 5000 );
sleep(1);
ret = usb_bulk_read(usbHandle, END_POINT_IN, rec, 3, 5000);
ret = usb_bulk_write(usbHandle, END_POINT_OUT, "AT+CBC\r" , 7, 5000 );
sleep(1);
ret = usb_bulk_read(usbHandle, END_POINT_IN, rec, 3, 5000);
ret = usb_bulk_write(usbHandle, END_POINT_OUT, buffer, 26, 5000);
ret = usb_bulk_read(usbHandle, END_POINT_IN, rec, 3, 5000);
--
___________________________________________________
car...@in...
+55 19 3801 7370
____________________________________________________
|