You are not logged in.

#1 2014-04-09 11:45:08

Xaero252
Member
Registered: 2011-11-28
Posts: 107

Bind USB port to specific /dev entry?

I know I probably need to use UDEV to accomplish this - but I'm not certain how. I have an arcade machine that uses USB ports for it's memory card interfaces. I'm running custom software on the machine - using ArchLinux as the base. The original game software utilized Debian, however I no longer have a copy of it, and instead wish to recreate the experience proper using this configuration.

I need the LEFT USB port to always be /dev/sdb and the right usb port to always be /dev/sdc; furthermore, I would like them to always mount to /media/player1 and /media/player2 - which I think I can accomplish with autofs, but I'm also not 100% certain, I've been reading wiki entries on both, but I'm having difficulty articulating the data there to this particular usage scenario. Any help would be greatly appreciated.

Offline

#2 2014-04-09 11:53:54

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: Bind USB port to specific /dev entry?

Do you always use the same two usb storage devices?

Offline

#3 2014-04-09 21:46:54

olive
Member
From: Belgium
Registered: 2008-06-22
Posts: 1,490

Re: Bind USB port to specific /dev entry?

Plug your device, find the device name, say /dev/sdb and do

find -L / -samefile /dev/sdc 2> /dev/null

The output will be something like:

/dev/sdc
/dev/disk/by-path/pci-0000:00:1a.0-usb-0:1.4:1.0-scsi-0:0:0:0
/dev/disk/by-id/usb-0930_USB_Flash_Memory_08E0A2713040E927-0:0
/dev/block/8:32

I think that /dev/disk/by-path/* point always to the same physical usb port. But usually it's better to use /dev/disk/by-id/* : they point to the port containg a given device, identified by its serial name. Do these link are sufficient for you? You could probably simply use them instead of /dev/sdb in your configuration. For your second question, if the cards are connected at boot simply edit the /etc/fstab file using the link as the device, or better use the file system UUID or label. For example, I have the following entry to always mount my backup usb disk at /mnt/dd_backup:

LABEL=DD_BACKUP /mnt/dd_backup ext4 ro,noauto,noatime   0       0

you can use UUID= or /dev/.. instead of LABEL= ; remove the noauto if you want the device to be automatically mounted at boot.

Last edited by olive (2014-04-09 21:47:53)

Offline

#4 2014-04-10 03:18:51

Xaero252
Member
Registered: 2011-11-28
Posts: 107

Re: Bind USB port to specific /dev entry?

To clarify - in theory any number of different USB sticks could be used as memory cards. Anything that a player decided to use to store his or her profile... which made it slightly more difficult to decide on the best method. That and I have to explicitly disable input devices for those two ports as well.

That said I think that /dev/disk/by - path seems to be sufficient for these purposes.

Last edited by Xaero252 (2014-04-10 03:24:17)

Offline

Board footer

Powered by FluxBB