Discussion:
[Libusb-win32-devel] Win7 speed issue
mabdallah
2015-10-22 12:18:39 UTC
Permalink
I'm trying to use libUSb-Win32 with USB-to-TTl serial converter to send raw
data just to test making usb driver on windows, the problem is that data
rate monitored on the bus using USBLyzer is 6.6msec per bit ! how can i
increase the speed to maximum available speed ?

N.B. Data is send correctly with no problem in data itself, the problem is
with speed.

Here is my code:
===========

usb_init();
usb_set_debug(255) ;
usb_find_busses();
num = usb_find_devices() ;

printf("Devices: %d\n", num) ;

busses = usb_get_busses();

for (bus = busses; bus; bus = bus->next) {
struct usb_device *dev;

for (dev = bus->devices; dev; dev = dev->next) {
if ((dev->descriptor.idVendor == 0x067B) &&
(dev->descriptor.idProduct == 0x2303)) {
mydev = usb_open(dev) ;

if (mydev == NULL)
{
printf("Error: usb_open\n") ;
}
else
{
printf("Device opened\n") ;

mreturn =
usb_set_configuration(mydev, 1) ;

if (mreturn != 0)
{
printf("Error:
usb_set_configuration\n") ;
}
else
{
printf("Config. set\n") ;

mreturn =
usb_claim_interface(mydev, 0) ;

if (mreturn != 0)
{
printf("Error:
usb_claim_interface\n") ;
}
else
{
printf("Interface
claimed\n") ;

mreturn =
usb_bulk_write(mydev, 2, data, 1000, 0) ;

if (mreturn < 0)
{

printf("Error: usb_bulk_write\n") ;
}
else
{
printf("Data
sent\n") ;
}



usb_release_interface(mydev, 0) ;
}
}
}
}
}
}



and here is USB info by testlibusb-win:
=========================


bus/device idVendor/idProduct
bus-0/\\.\libusb0-0001--0x067b-0x2303 067B/2303
- Manufacturer : Prolific Technology Inc.
- Product : USB-Serial Controller
bLength: 18
bDescriptorType: 01h
bcdUSB: 0110h
bDeviceClass: 00h
bDeviceSubClass: 00h
bDeviceProtocol: 00h
bMaxPacketSize0: 40h
idVendor: 067Bh
idProduct: 2303h
bcdDevice: 0300h
iManufacturer: 1
iProduct: 2
iSerialNumber: 0
bNumConfigurations: 1
wTotalLength: 39
bNumInterfaces: 1
bConfigurationValue: 1
iConfiguration: 0
bmAttributes: a0h
MaxPower: 50
bInterfaceNumber: 0
bAlternateSetting: 0
bNumEndpoints: 3
bInterfaceClass: 255
bInterfaceSubClass: 0
bInterfaceProtocol: 0
iInterface: 0
bEndpointAddress: 81h
bmAttributes: 03h
wMaxPacketSize: 10
bInterval: 1
bRefresh: 0
bSynchAddress: 0
bEndpointAddress: 02h
bmAttributes: 02h
wMaxPacketSize: 64
bInterval: 0
bRefresh: 0
bSynchAddress: 0
bEndpointAddress: 83h
bmAttributes: 02h
wMaxPacketSize: 64
bInterval: 0
bRefresh: 0
bSynchAddress: 0


Thanks



--
View this message in context: http://libusb.6.n5.nabble.com/Win7-speed-issue-tp5715261.html
Sent from the LibUSB Dev - Win32 mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Xiaofan Chen
2015-10-23 11:53:13 UTC
Permalink
Post by mabdallah
I'm trying to use libUSb-Win32 with USB-to-TTl serial converter to send raw
data just to test making usb driver on windows.
bus/device idVendor/idProduct
bus-0/\\.\libusb0-0001--0x067b-0x2303 067B/2303
- Manufacturer : Prolific Technology Inc.
- Product : USB-Serial Controller
This is not really a good device for learning. It is a USB
to serial converter and Prolific provides the driver so
that you can use serial API to talk to the device.

Anyway, you may want to take a look at the example
of using the async API.
http://sourceforge.net/p/libusb-win32/code/HEAD/tree/trunk/libusb/examples/bulk.c

If you want to use the sync API, it is also possible, just
write more data in one go and the speed should be faster.
--
Xiaofan

------------------------------------------------------------------------------
Loading...