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

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <svenito@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.019
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; 'handler': 0.05; 'subject:Getting': 0.07; 'inserted': 0.09; 'latter': 0.09; 'parsing': 0.09; 'subject:number': 0.09; 'python': 0.11; '2.7': 0.14; 'fine.': 0.16; 'reliably': 0.16; 'users.': 0.18; 'seems': 0.21; '(the': 0.22; 'install': 0.23; 'creating': 0.23; 'installation': 0.23; "i've": 0.25; 'query': 0.26; 'tried': 0.27; 'function': 0.29; 'specifically': 0.29; "doesn't": 0.30; 'message- id:@mail.gmail.com': 0.30; 'getting': 0.31; 'accomplished': 0.31; 'object.': 0.31; 'way?': 0.31; 'linux': 0.33; 'checking': 0.33; 'to:name:python-list': 0.33; 'device': 0.34; "i'd": 0.34; 'subject:from': 0.34; 'requirement': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'installing': 0.36; 'doing': 0.36; 'thanks': 0.36; 'too': 0.37; 'list.': 0.37; 'skip:& 10': 0.38; 'to:addr:python-list': 0.38; 'rather': 0.38; 'little': 0.38; 'to:addr:python.org': 0.39; 'how': 0.40; 'number,': 0.60; 'devices': 0.61; 'entire': 0.61; 'information': 0.63; 'kind': 0.63; 'skip:n 10': 0.64; 'serial': 0.72; 'inefficient': 0.91; 'luck': 0.93
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to :content-type; bh=9vZwJc4v7GlFROtXpyAeqPVg84il1yIjI8maOLHr29Y=; b=YiZq+E1HCIA0gHVgNAC9IoQAoFaery5X27m+qL7KXrCHs+Ru0z/NBbuGVYp/b31T/x 4g4RYIeZDr/FSJ8+pHAS6wxzlu9Ac09reJFcZTXVYPOHhle7aQipCdQFy2LrlMueUSpp G/TS805UJip1YpzflZiHmWB6WbepWHtXoJTiCmdejsUsFM/blcIezXDFjbhuz94fB05j J0KiViArgN/aH4azj+jasgFBPlzx89BDspw9KMy2G9dHhHMKKjYyN6byajIp/z72JKpI QD4WTAeiYmmINGEXRwuRPUpBRBMmQIfwEnzLy8MTs5ztpSAPdbqney9z45bxXJpZG2im XIFw==
MIME-Version 1.0
X-Received by 10.194.71.110 with SMTP id t14mr24877717wju.53.1364941138769; Tue, 02 Apr 2013 15:18:58 -0700 (PDT)
Date Tue, 2 Apr 2013 23:18:58 +0100
Subject Getting USB volume serial number from inserted device on OSX
From Sven <svenito@gmail.com>
To python-list <python-list@python.org>
Content-Type multipart/alternative; boundary=047d7bfd0bd6b73d6304d9681f08
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.25.1364941140.3114.python-list@python.org> (permalink)
Lines 77
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1364941140 news.xs4all.nl 6928 [2001:888:2000:d::a6]:60612
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:42609

Show key headers only | 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