Detecting usb device insertion on Linux using PY

System-oriented questions right here.

Moderators: KDoiron, ChrJim, mawe, python

Detecting usb device insertion on Linux using PY

Postby asimmittal on Mon Mar 08, 2010 12:57 am

Hey

I think this question has more to do with linux than python actually. I will post it here nonetheless.

I have recently written a script to detect activity on my usb ports. It simply keeps polling the output of the 'LSUSB' shell command and detects changes based on successive comparisons. This works fine... but I still have a problem about how to connect this change to an actual location on my system (path to the usb device). I thought of polling the output of mount, as the pen drives and hard drives get auto mounted on my system. But what if two are plugged together??

Is there some way I can perhaps make a connection with the info I get from 'lsusb' to a physical location corresponding to that device?

Thanks
Asim
User avatar
asimmittal
New Python User
New Python User
 
Posts: 48
Joined: Sat May 23, 2009 12:14 am
Location: India

Re: Detecting usb device insertion on Linux using PY

Postby pythonista on Mon Mar 08, 2010 10:55 am

Use Hal+DBUS
User avatar
pythonista
Python Guru
Python Guru
 
Posts: 531
Joined: Wed Jun 25, 2008 6:32 pm
Location: Maryland


Return to System Administration

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Dreamlink Web hosting and Traduzioni Rumeno Italiano and ASSP Deluxe for cPanel.