LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-25-2011, 01:08 PM   #1
Equinn
LQ Newbie
 
Registered: Feb 2008
Location: California
Distribution: Slackware 13.1
Posts: 24

Rep: Reputation: 0
Help with USB storage program and USB 3.0


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 2.6.24.5.

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.

Thanks,
Equinn

Last edited by Equinn; 01-25-2011 at 02:39 PM.
 
Old 01-26-2011, 04:46 PM   #2
Equinn
LQ Newbie
 
Registered: Feb 2008
Location: California
Distribution: Slackware 13.1
Posts: 24

Original Poster
Rep: Reputation: 0
Guys and Gals,

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.

Quote:
USB 2.0 Drive
bmAttributes = c0h
MaxPower = 1
bInterval = 0

USB 3.0 Drive
bmAttributes = 80h
MaxPower = 200
bInterval = 20
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.

Thanks,
Equinn

Last edited by Equinn; 01-26-2011 at 04:51 PM. Reason: Format corrections
 
  


Reply

Tags
slackware, storage, usb



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] usb-storage + usb card-reader = klogd spamming logs GrapefruiTgirl Linux - Kernel 9 08-10-2009 09:34 AM
How to disable USB Mass Storage device ( usb drive ) in Linux vijaush Linux - Newbie 4 06-25-2008 09:43 AM
Recharge iPod shuffle / USB high-powered ports / Disabling USB storage recognition simopal6 Linux - Hardware 1 05-31-2008 12:42 PM
After plug in apacer ht202 usb mass storage into usb port. Nothing appear. tellmeimhong Linux - Hardware 3 02-04-2006 02:32 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:13 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration