LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 12-31-2003, 12:04 AM   #1
TigerLeo
LQ Newbie
 
Registered: Dec 2003
Posts: 3

Rep: Reputation: 0
For those who still have problems with USB HD


This message is for those who have known the proper way to mount USB Mass Storage on Linux, but still have problem with mounting the device. For those who have no idea about generic commands dealling with USB devices on linux, please refer to other resources.

So let me repeat the problem again.
First, su to root user.
1. For those AREN'T using hotplug:
run command lsmod, the leftmost column of the output should include:
uhci_hcd (or usb_uhci if the kernel version is 2.4.*)
ehci_hcd
usbcore
usb_storage
scsi_mod
sd_mod
2. For those ARE using hotplug:
run command lsmod, the leftmost column of the output should include:
uhci_hcd (or usb_uhci if the kernel version is 2.4.*)
ehci_hcd
usbcore

After inserting the USB HD in, check the file /proc/bus/usb/devices, there should be one section looks like:
T: Bus=04 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=12 MxCh= 0
D: Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
P: Vendor=05e3 ProdID=0702 Rev= 1.13
S: Product=USB Storage Device
C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=500mA
I: If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
E: Ad=81(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms
E: Ad=02(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms

Notice the "Driver=usb-storage",which is different from other sections,whose corresponding sentences are "Driver=hub". That's your USB Mass Storage. But the problem is, no matter how you mount your USB HD(mount -t vfat /dev/sda1 /mnt/usbdir or what ever you've tried), you get this:
mount: /dev/sda1 is not a valid block device
And, if you run command dmesg, the output could include lines like:
hub 4-0:1.0: new USB device on port 1, assigned address 2
scsi3 : SCSI emulation for USB Mass Storage devices
scsi scan: 37 byte inquiry failed with code 458752. Consider BLIST_INQUIRY_36 for this device
WARNING: USB Mass Storage data integrity not assured
USB Mass Storage device found at 2

and there are similar lines in the file /var/log/messages. What's wrong? The device seems been detected by the system, why still doesn't it get working?

I think I've got the solution to most of the cases. It needs some kernel hacking work. cd into directory $(KERNEL-SRC)/drivers/usb/storage, check file unusual_devs.h and usb.c, you could recognize that there is a device type list, from which usb kernel modules get the information of available device types, if your device type is out of this list unfortunately, the problem above will definitely catch you :-)
How to fix it? Let's have a look at your device section in /proc/bus/usb/devices again, notice the line beginning with letter P, this line describes the Vendor ID, Product ID and Revision of your USB device, in my case, they are 0x05e3, 0x0702 and 0x0113 respectively. Take another look at the line beginning with letter I, this line describes the Interface Class, Interface SubClass, and Interface Protocol of your device. In my case, they are 0x08(Mass Storage), 0x06(Transparent) and 0x50(Bulk Only).
Now get into the file unusual_devfs.h, you can find many statements similar to the following:
UNUSUAL_DEV( 0x05e3, 0x0702, 0x0000, 0x0001,
"EagleTec",
"External Hard Disk",
US_SC_DEVICE, US_PR_DEVICE, NULL,
US_FL_FIX_INQUIRY ),
This macro defines one item in the Mass Storage device type list, I translate it as:
UNUSUAL_DEV( Vendor ID, Product ID, bcdDeviceMin, bcdDeviceMax,
Vendor Name,
Product Name,
Interface SubClass, Interface Protocol, NULL,
US_FL_FIX_INQUIRY ),
Refer to the files to understand the last two parameters. Now try to find an identical one to your device in terms of Vendor ID and Product ID, get it? If the last four params are US_SC_DEVICE, US_PR_DEVICE, NULL and US_FL_FIX_INQUIRY, congratulations, you get it! If you can't find one, compose one by yourself.
Now the most exciting comes, check the bcdDeviceMax, is it smaller than your device's? Yes! It is. In /proc/bus/usb/devices, it says my device's revision is 0x0113, but the bcdDeviceMax in the UNUSUAL_DEV macro is 0x0001, too small! Now change this number(in my case, 0x0001) to, say 0x0200(larger than 0x0113) that is larger than your device's. OK, save the file unusual_devs.h.
Now, recompile the kernel module usb-storage. On kernel 2.6.0, you can run command:
make -C $(KERNEL-SRC) SUBDIRS=$(KERNEL-SRC)/drivers/usb/storage modules
where $(KERNEL-SRC) is the directory where your kernel source resides in.
For those still using kernel 2.4.*, figure it out yourself how to compile one kernel module separately. And the result is a .o file named usb-storage.o
Successfully recompile your kernel module? OK, copy usb-storage.ko(or usb-storage.o for kernel 2.4.*) to your system kernel library directory, most of the case, /lib/modules/$(KERN_VERSION)/kernel/drivers/usb/storage, where $(KERN_VERSION) is the kernel version, e.g. 2.6.0.
Reload your kernel module usb-storage. OK, all needed has been done, insert your USB HD in and enjoy it.
What? Still it doesn't work? None of my business :-)

Last edited by TigerLeo; 12-31-2003 at 04:41 AM.
 
  


Reply



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
how to search in VI wih case insensitive lordofring Programming 7 11-16-2011 08:11 AM
Problems wih firestarter firewall lostn1slinux Linux - Software 0 12-01-2005 01:19 PM
Help wih Mplayer..? jmr0311 Linux - Software 2 07-31-2004 12:20 PM
WinTV Nova-t USB wih kernel 2.6.5 ? K@rl` Linux - Hardware 2 05-10-2004 06:02 AM
Trouble wih X Server: Could not load module chem1 Linux - Hardware 3 02-14-2004 09:06 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 12:36 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