Posted: Thu 28 Jun 2012, 00:00 Post_subject:
Map device serial number to device names
All 3 USB ports on my computer are in use all the time and 2 are so close that a slight jiggle, a touch of one means a new device assignment in ascending order. This can be catastrophic in the midst of a download. Communications software that allows downloads to be resumed and completed after disconnection is nullified because of the changed destination.
In Windows, I once knew how to obtain the device type and serial number for each connected device. Is there a way to obtain same from puppy/Linux? If so, I have an idea for a pet that may perk someone's interest. Let's say the pet would be called lockdrives. When called/run it would obtain the serial number of each mounted drive, the assigned device name it is mapped to and set a flag (DRIVELOCK). The existing routine that polls the ports and assigns a new device name would check DRIVELOCK and if set, check if the serial number of the newly plugged in drive matches that which was locked. If they match, then reassign the old device name to the drive.
The pet and DRIVELOCK flag may not be even necessary. Just add/modify the existing code to read, log and map serial numbers and device name at boot and when a port is populated. When a drive is added, compare its serial number with that of the last resident. If it matches, then reassign the same device name. If different, do what is done now - assign the next higher number for the device type and update the device table.