If boot.py runs before the PyBoard is in MSD, then it might make sense to allow setting the label.You can tell if the USB mode is in MSD mode (mass storage) but I don't think there is any reliable way to detect if the volume is mounted.
This seems like the road to grief. Too unreliable to be worthy of program flash space, IMHO. Changing the label after the MSD is mounted is not going to be a good thing, so any system call that allows changing the label must be able to raise a "You're way too late for that, dude." exception. Anything else leads to user confusion and bugs.There might be patterns of sector read/write for a particular OS that mean mount or unmount, but that's hard to get working.
On the topic of serial numbers, I dug around a bit and found:
Code: Select all
ATTRS{idVendor}=="067b",ATTRS{idProduct}=="2303",SYMLINK+="ttyBeagle"
ATTRS{idVendor}=="2108",ATTRS{idProduct}=="780b",SYMLINK+="ttyXV11",MODE="0666"
After thinking further about my code deployment options, I could live with manually set volume names. A system call to set the volume name must be able to tell if the PyBoard is in MSD mode and raise an exception if it is. Which pre-supposes the ability to run code before the PyBoard is in MSD mode.
The serial number in the CDCACM device descriptor seems like the right thing to do on general principals, and worth the effort.