I need to read the serial number from an SD card in order to identify the volume for a cross-platform application. This is the 4-byte identifier located at offset 440 on the device at /dev/rdiskX.
On Linux and Windows, this number is obtained via blkid or udevadm, and getVolumeInformation() respectively - I wish to obtain this number in order to have the same identifier for the SD card available on the Mac version of the application.
I can access the longer UUID generated from the serial ID using diskutil or msdos.util, however these utilities don't seem to expose the raw serial ID. The function fs_get_uuid_raw in the sourcefor msdos.util seems to read this information into a structure and then run an md5 hash to generate the final UUID. The required bytes can be obtained with the 'dd' command but permissions are a problem.
crw-r----- 1 root operator 1, 6 Dec 14 19:27 /dev/rdisk3Running msdos.util as a user works because of some codesign permissions.