How to connect a USB mass storage device that has a custom pid and vid

modprobeprocessudevusb

I have a device, custom mp3 player, that the pid and vid show up as a011:a011.

dmesg

usb 1-1.1: new high-speed USB device number 4 using ehci-pci
usb 1-1.1: New USB device found, idVendor=a011, idProduct=a011
usb 1-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=5
usb 1-1.1: Product: Custom-Mp3
usb 1-1.1: SerialNumber: 123456789abcdef
usb 1-1.1: USB disconnect, device number 4
usb 3-3: new high-speed USB device number 2 using xhci_hcd
usb 3-3: New USB device found, idVendor=a011, idProduct=a011
usb 3-3: New USB device strings: Mfr=1, Product=2, SerialNumber=5
usb 3-3: Product: Custom-Mp3
usb 3-3: SerialNumber: 123456789abcdef

I can connect to this device in windows 7 by selecting a generic mass storage device driver. It has a single fat32 partition that I can read and write to.

My system is Ubuntu 14. Every thing works. I connect a USB thumb drive and it auto loads the driver and creates the /dev/sdX point.

How do I connect this mp3 player to my linux pc. If I can create the /dev/sdX point then I can mount it.

I have been reading and trying to use modprobe and creating a /etc/udev/rules.d/80-mp3_a011.rules, but It has not clicked yet.

I would like to connect a single time via the command line first.

Next I would like it to connect every time I plug it in.

Last using this information I will create the rules for mdev that I use on my embedded system.

Best Answer

Got the second part working.

"Next I would like it to connect every time I plug it in."

Created a udev rule at:

sudo vi /etc/udev/rules.d/80-mp3_a011.rules

Added this info that simply modprobes usb-storage and adds my pid:vid to the usb-storage new_id.

ACTION=="add", ATTRS{idVendor}=="a010", ATTRS{idProduct}=="a010", RUN+="/sbin/modprobe usb-storage" RUN+="/bin/sh -c 'echo a011 a011 > /sys/bus/usb/drivers/usb-storage/new_id'"

restart udev

sudo /etc/init.d/udev restart

Now as soon as I connect the device it is handled like any other usb mass storage device.

First part working:

"I would like to connect a single time via the command line first."

sudo echo a011 a011 > /sys/bus/usb/drivers/usb-storage/new_id

Did NOT work because the sudo was applied to the echo command and not the new_id file, or some such thing.

Changed to a root shell first then added the PID:VID to the new_id.

sudo su

echo a011 a011 > /sys/bus/usb/drivers/usb-storage/new_id
Related Question