The binary file is located on a USB key used as a dongle.
I need to get a unique identifier from the key. VendorID + DeviceID is out of the question because they may be the same if the USB key's models are the same.
Using Windows, I use a the function GetVolumeInformation()
which gives me a serial number that is changed eachtime the device is formated (not a problem).
Using Unix, to get the same serial number, I need to read the corresponding mount file in the /dev/
directory. But this operation requieres a root access, or at least I need to be part of a specific group.
The unique identifier could be different than the serial number found on Win32 systems. But it must be different for each USB key I will use for delivery.
Any ideas ?
I have managed to retrieve the serial number by getting the /dev file using df
command
Than used this code and modified it a little bit :
USB-drive serial number under linux C++
3rd answer (Orwellophile's)
I'm not sure this will work on every Unix systems, but it is fine for now.