ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
OK, I admit I'm a newbie at this - especially the linux part. I have inherited a USB storage program that tests USB hard disk drives. Up to now, I have been successful at making updates to the code when needed because accessing the USB device has never been a problem.
First, I am running Slackware 12.1.0 with Linux Kernel 184.108.40.206.
The program basically monitors the USB devices via /proc/bus/usb/devices and when there's a new device, checks to see if the vendor ID is one it should test. If so, the first thing it does is go out and do a read capacity via the usb_bulk_write (eventually), which I assume is in the usb library located in /usr/include (please verify). I know that usb.h is in the includes in the usb_storage.c that is part of the program code.
Anyway, this has always worked on USB 2.0 devices, but now that I have a USB 3.0 device, it errors out at the usb_bulk_write command (return code is 31). I was under the impression that USB 3.0 was backward compatible. Also, if I just plug in the drive without running my program, the system sees it just fine. I am just plugging the USB 3.0 device into a USB 2.0 bus.
I am kind of at a loss as to what would be causing this. Seems to me if it worked on USB 2.0, it would work on 3.0. Any ideas would be appreciated.
I have done some more digging around and have more information. This program is using libusb v0.1.12. Also, I made a mistake in my statement above. It's not failing at usb_bulk_write (the return code from that is 31, which is the correct number of bytes transferred). It's actually failing on the subsequent usb_bulk_read. It's supposed to return 8 bytes and its returning 0.
After some searching on the net, I found some information on libusb. I found there is a bit of test software that's distributed with libusb that identifies information about the devices attached to the bus. I ran this little test on both types of drives and found that there are some differences.
All of the other information was the same between the two drives. I'm wondering if any of these things are used by usb_bulk_read. I'm off to do more digging, but hopefully this will spark some thoughts on this and help me get there a little faster.
Last edited by Equinn; 01-26-2011 at 04:51 PM.
Reason: Format corrections