USB
USB Drives under Windows
Some references:
- http://www.uwe-sieber.de/usbtrouble_e.html
- http://www.uwe-sieber.de/usbstick_e.html
- http://www.ghacks.net/2008/10/16/how-to-create-multiple-usb-stick-partitions/
Creating multiple partitions on a single USB drives
From [1], Nearly all USB flash drives pretend to have a removable media (even it's a lie), so Windows detects them as 'removable'. On drives with a removable media Windows 2000 and higher supports only one partition. Finally it's a single bit in the device's device descriptor, the removable media bit (RMB). If you take away the RMB then Windows sees the drive as local disk and multiple partitions work.
To have Windows not to handle USB drives as removable media, just install a filter driver that will remove the RMB flag. Check here.
USB Power Control
Reference
wget http://www.gniibe.org/oitoite/ac-power-control-by-USB-hub/hub-ctrl.c
sudo apt-get install libusb-dev
gcc hub-ctrl.c -lusb -o hub-ctrl
#Get info on USB devices:
lsusb -t
sudo ./hub-ctrl -v
# Hub #0 at 001:056
# INFO: individual power switching.
# WARN: Port indicators are NOT supported.
# Hub Port Status:
# Port 1: 0000.0100 power
# Port 2: 0000.0303 lowspeed power enable connect
# Port 3: 0000.0100 power
# Hub #1 at 001:055
# INFO: individual power switching.
# WARN: Port indicators are NOT supported.
# Hub Port Status:
# Port 1: 0000.0103 power enable connect
# Port 2: 0000.0100 power
# Port 3: 0000.0103 power enable connect
Let's for instance cut device on port 3 at 001:055 (i.e. bus 1, dev 55):
beq06659@nxl67002ux ~/tmp/hub-ctrl (master)
sudo ./hub-ctrl -b 1 -d 55 -P 3 -p 0 # See 'USB Permissions' to get rid of 'sudo'
# Hub #0 at 001:056
# INFO: individual power switching.
# WARN: Port indicators are NOT supported.
# Hub Port Status:
# Port 1: 0000.0100 power
# Port 2: 0000.0303 lowspeed power enable connect
# Port 3: 0000.0100 power
# Hub #1 at 001:055
# INFO: individual power switching.
# WARN: Port indicators are NOT supported.
# Hub Port Status:
# Port 1: 0000.0103 power enable connect
# Port 2: 0000.0100 power
# Port 3: 0000.0000
Advices:
- Avoid hub with cheap Genesys Logic chip inside.
- Good hub is Linksys 4-port hub, with external power cable.
WORKS | DOES NOT WORK |
---|---|
DELL docking station HUB (ID 413c:2513 Dell Computer Corp) Hub with NEC chipset (like Linksys USB2HUB4 USB 2.0 hub.) |
Genesys Logic chipset |
USB Permissions
On Linux, access permissions on files located at /dev/bus/usb define permissions to corresponding USB devices.
For instance, to avoid using sudo when using usb-ctrl, we could do:
sudo chgrp $USER /dev/bus/usb/001/055 # Change group ownership for usb on bus 001, device 055
./hub-ctrl -b 1 -d 55 -P 3 -p 0 # We no longer need sudo
A better solution is to change udev rules to make these permissions permanent.