How do I use udev to find info about inserted video media (e.g. DVDs)
Posted
by Daniel
on Stack Overflow
See other posts from Stack Overflow
or by Daniel
Published on 2010-05-18T20:54:06Z
Indexed on
2010/05/18
21:50 UTC
Read the original article
Hit count: 129
I'm trying to port an application from using HAL to using pure udev. It is written in python and will use the gudev library, though I would love to see examples in any language. I'm able to get all attached video devices (such as cameras) via:
import gudev
client = gudev.Client(["video4linux"])
for device in client.get_devices():
print device.get_sysfs_attr("name"), device.get_device_name()
This prints out something like:
USB2.0 UVC WebCam /dev/video0
I am also able to get a list of block devices, but how can I:
Tell if it is a CD/DVD drive?
Tell if media is currently inserted if the drive supports removable media?
Tell what the name/label of the media is (e.g. FUTURAMAS1 for a DVD)?
The original code I am trying to port over is located at http://github.com/danielgtaylor/arista/blob/045a4d48ebfda44bc5d0609618ff795604ee134f/arista/inputs.py
Any and all help would be greatly appreciated!
© Stack Overflow or respective owner