Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #42609

Getting USB volume serial number from inserted device on OSX

Date 2013-04-02 23:18 +0100
Subject Getting USB volume serial number from inserted device on OSX
From Sven <svenito@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.25.1364941140.3114.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

Hello,

I am using Python 2.7 with pyobjc on Lion and NSNotification center to
monitor any inserted USB volumes. This works fine.

I've also got some ideas how to get a device's serial number, but these
involve just parsing all the USB devices ('system_profiler SPUSBDataType'
command). However I'd like to specifically query the inserted device only
(the one creating the notification) rather than checking the entire USB
device list. The latter seems a little inefficient and "wrong".

Can this be accomplished in a sensible way? The NSNotification object
passed to my handler function doesn't have that kind of information and
I've not been able to find any information on doing the above with the
information provided by the NSNotification object.

I've tried DBus (I use this for the linux handler) but I've not had much
luck getting it to work reliably on OS X and installing it wasn't as
straightforward as I hoped.

I have no requirement to use pyobjc so other suggestions welcome as long as
it's straightforward to install and without too many other dependencies.
I'd like to keep installation straightforward for the end users.
Thanks

-- 
./Sven

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Getting USB volume serial number from inserted device on OSX Sven <svenito@gmail.com> - 2013-04-02 23:18 +0100
  Re: Getting USB volume serial number from inserted device on OSX John Nagle <nagle@animats.com> - 2013-04-04 18:58 -0700
    Re: Getting USB volume serial number from inserted device on OSX Tim Roberts <timr@probo.com> - 2013-04-04 22:20 -0700
      Re: Getting USB volume serial number from inserted device on OSX Sven <svenito@gmail.com> - 2013-04-05 14:23 +0100

csiph-web