Results 1 to 5 of 5
Hello,
I am rewriting Zydas zd1201 driver in user space using libusb (I am going to port it to embedded device in the future).
I was able to find the ...
- 09-20-2007 #1Just Joined!
- Join Date
- Dec 2006
- Posts
- 26
[SOLVED] libusb - usb_bulk_read() problem
Hello,
I am rewriting Zydas zd1201 driver in user space using libusb (I am going to port it to embedded device in the future).
I was able to find the device (Zydas ZyAIR B-220), open it, detach it's kernel driver, claim interface and upload firmware into it using usb_control_msg(). Sending INIT command to the device using usb_bulk_write() works fine.
But usb_bulk_read() works strangely. Every time it returns -110 (ETIMEDOUT). But actually, there is data of the requested length in the buffer. Problem is, that this data is not read from the device, but belongs to another applications (for example contacts from gaim, information about network, batery, filesystem ... ).
Do you think it could be a bug in libusb or in my linux distribution (UBUNTU)? Tanks in advance, Vita.
I am providing the piece of code:
Code:int ret; char *cnfbuf; cnfbuf = (char *)malloc(ZD1201_RXSIZE); memset(cnfbuf, 0, ZD1201_RXSIZE); ret = usb_bulk_read(zd->usb_handle, 0x81, cnfbuf, ZD1201_RXSIZE+1,1000);
- 09-21-2007 #2Just Joined!
- Join Date
- Jun 2006
- Posts
- 15
My rply may not help u in straight way...
First find whether this libusb will suitable for your req driver type. I tried to used Libusb b4 one year back for accessing USB block device such as USB Pen drive. Finally I found that libusb was not suitable for block drivers. I dont know the current status of the libusb.
No more suggestions.
===============
Prakash
electronica is the site for learners and beginners
- 09-24-2007 #3Just Joined!
- Join Date
- Dec 2006
- Posts
- 26
Hello Prakash!
Thank you for your answer. It is possible that this can be the problem. Libusb may not be the right way for implementing network drivers (my device is wifi stick).Could you please tell me how did you find out that libusb is not suitable for block drivers? Last days I have been googling a lot, but I haven't found any mention about this.
Thanks in advance, I hope to hear from you again.
Vita
- 09-26-2007 #4Just Joined!
- Join Date
- Jun 2006
- Posts
- 15
Sure. We posted our query to libusb mailing list. Below i have pasted the reply for our query..
>Hello ,
> Ya i know to access the USB through usb memeory
>drive.But me primarly intersted to access the USB 2.0 through Libusb
>only. already i accessed the details of the USB through Libusb 0.1.12.Now
>me want to access the FIles in USB. Actually i am trying to access the
>file through this kind of program as shown below:
>
I responded to this message the first time you sent it, on Thursday.
Did you see that reply?
The program you sent was written to control some other type of device,
not a USB memory stick.
> So How to
> access the FIles in USB through The LIBUSB and .A need a
>corrected program to show the Listing of files in USB through LIBUSB.
> Plz do help me...
>
You don't need "a corrected program". You need "a completely different
program".
I'll repeat myself. If all you want is a list of files on the device,
just let the operating system load its drivers and mount the file
system. What you ask is much more difficult than you think. You will
have to learn the USB Memory Class Spec, the SCSI command set, and the
FAT file system before you can fetch directory sectors from the memory
stick. It's likely to be a month or more of completely unnecessary work.
Once you got the concept of libusb, then u can easily under stand, this is not suitable for these kind of stuffs. Better you can post your query for that mailing list. Hope you will get the immed reply.
===============
Prakash
electronica is the site for learners and beginners
- 09-27-2007 #5Just Joined!
- Join Date
- Dec 2006
- Posts
- 26
Solved!
Hi,
yesterday I solved it. Sorry for needless question. The mistake was between chair and key bord
I just badly understood the driver code. Libusb is quite simplified library and I must call it in different order.



