[Pythonmac-SIG] how to retrieve unique serial number from usb storage device

David Hughes dfh at forestfield.co.uk
Sat Nov 26 10:30:32 CET 2011


On 25/11/2011 22:20, Brendan Simon (eTRIX) wrote:
> On 26/11/11 12:12 AM, David Hughes wrote:
>> On 25/11/2011 11:22, Brendan Simon (eTRIX) wrote:
>>> Anyone know how to retrieve the unique serial number of a usb storage
>>> device using python on OS X ??
>> How about using
>>
>> system_profiler SPUSBDataType
> I treid the system_profiler and got the following results when I plugged
> a couple of usb flash sticks in.
> I couldn't see anything that resembles a unique usb storage device
> serial number :(  I think it is supposed to be a 12 digit (hex) number.
>
> Either system_profiler doesn't report it, or these devices don't have
> unique serial numbers (unlikely), or I am missing something (not unlikely).
>
> Any thoughts ??

Strange, I just tried it here and got a serial number as usual (OS X 
10.7.2 and also 10.6.8):

             STORE N GO:

               Capacity: 4 GB (4,001,366,016 bytes)
               Removable Media: Yes
               Detachable Drive: Yes
               BSD Name: disk1
               Product ID: 0x3623
               Vendor ID: 0x13fe  (Phison Electronics Corp.)
               Version: 1.10
               Serial Number: 079A1111814F57E3
               Speed: Up to 480 Mb/sec
               Manufacturer: Verbatim
               Location ID: 0xfa130000 / 6
               Current Available (mA): 500
               Current Required (mA): 200
               Partition Map Type: MBR (Master Boot Record)
               S.M.A.R.T. status: Not Supported
               Volumes:
                 DEVELOPER:
                   Capacity: 4 GB (3,997,237,248 bytes)
                   Available: 3.76 GB (3,759,636,480 bytes)
                   Writable: Yes
                   File System: MS-DOS FAT32
                   BSD Name: disk1s1
                   Mount Point: /Volumes/DEVELOPER
                   Content: DOS_FAT_32

To check if your device does have a serial number can you run the 
attached python script using Windows?
The above device reports:

USB Device Id is USB\VID_13FE&PID_3623\079A1111814F57E3 (VBscript)

-- 
Regards

David Hughes
Forestfield Software



-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: usbid_script.py
URL: <http://mail.python.org/pipermail/pythonmac-sig/attachments/20111126/e4763c1e/attachment-0001.ksh>


More information about the Pythonmac-SIG mailing list