I'm investigating dynamic device name mapping via udev.The goal:On a multi user system, each user can allocate and free devices like usb-serial converters or PCIe cards (FPGAs). If an user allocates a device, the /dev/<user>/<device> nodes shall be created with a dynamic name and permissions for the allocating user. If the user releases the device the devfs nodes need to be removed/renamed and the permissions need to be revoked.Current situation:I'm experimenting on /dev/ttyUSB1 - an usb-serial converter. I wrote a Python script which is called from udev while creating the dev-node. It expects the VendorID, ProductID and SerialNo of a usb device and returns the devfs node name: e.g. paebbels/ttyUSB. This works with symlinks, so the original devfs node ttyUSB1 is still present.How can I use my script to change the original devfs name?I tried to use the NAME command in my udev rule, but it does not work. The documentation states: NAME can only be used once. Is there a default rule in udev which uses NAME before my rule?/etc/udev/... does not contain such a rule.In a latter phase, my script will also return the username, group and permissions for the devfs node.Secondary question:Should I create the device files as planned in /dev/<user>/<device> or in ~/fpga1/<device>?
Where is the default device name (e.g. /dev/ttyUSBx) specified?
debian;python;udev;devices
1. Question:I am not sure, but take a look at /lib/udev/rules.d/60-persistent-serial.rules2. Question:If udev itself assigns the device names I would put them all in a subdirectory of /dev. If not in /run/$UID/devices.