This is an old revision of the document!
Preparations for porting thunar-volman to udev/GIO
HAL is undergoing deprecation at the moment. All major distributions push for the
removal of HAL in favor of DeviceKit-disks/udisk, DeviceKit-power/upower and udev.
thunar-volman uses HAL for distinguishing different device types like portable
audio players, removable media, cameras, printers etc.
In order to port thunar-volman to udev and GIO, we need to collect
information about how device types can be distinguished via udev. Mounting
removable media should be a no-brainer if we use GVolumeMonitor and GIO.
How to reliably identify certain device types via udev/GIO
Storage
Removable Drives (CD/DVD/Blu-ray drives, no mass storage devices)
Udev property | Value |
DEVTYPE | disk |
ID_TYPE | cd/… |
SUBSYSTEM | block |
Udev property | Value |
DEVTYPE | partition |
DKD_PARTITION | 1 |
ID_FS_USAGE | filesystem |
ID_TYPE | disk |
SUBSYSTEM | block |
Udev property | Value |
DEVTYPE | partition |
ID_FS_USAGE | crypto |
ID_TYPE | disk |
SUBSYSTEM | block |
Blank CDs and DVDs
Udev property | Value |
ID_CDROM_MEDIA_STATE | blank |
ID_CDROM_MEDIA_CD_R | 1 |
Audio CDs
Udev property | Value |
DKD_MEDIA_AVAILABLE | 1 |
ID_CDROM_MEDIA_TRACK_COUNT_AUDIO | >0 |
ID_CDROM_MEDIA | 1 |
DVDs
Udev property | Value |
DKD_MEDIA_AVAILABLE | 1 |
ID_CDROM_DVD | 1 |
ID_CDROM_MEDIA | 1 |
ID_CDROM_MEDIA_TRACK_COUNT | >0 |
Blue-ray Disks
Video CDS
Portable Music Players
Some portable music players can be identified using the following udev properties:
Udev property | Value |
DKD_PRESENTATION_ICON_NAME | multimedia-player |
ID_MEDIA_PLAYER | |
Others have to be mounted like mass storage devices first. Afterwards, an investigation
of their file system is necessary. Here's a list of special music folders of certain
devices:
Device | Music folder |
iPod Nano 3rd Generation | iPod_Control/Music |
Cameras
Some cameras can be identified by special gphoto2 and probably PTP properties:
Udev property | Value |
ID_GPHOTO2 | 1 |
GPHOTO2_DRIVER | |
Cameras not supporting this are usually represented as mass storage devices. Our
only chance to distinguish them from normal mass storage devices is via special
folders like:
DCIM
dcim
iPod_Control/Photos
…?
PDAs
Palms
Pocket PCs
Printers
USB printers
Udev property | Value |
DRIVER | usblp |
Keyboards
Udev property | Value |
ID_CLASS | kbd |
ID_TYPE | hid |
SUBSYSTEM | input |
Mice
Udev property | Value |
ID_CLASS | mouse |
ID_TYPE | hid |
SUBSYSTEM | input |
Tablets
Wacom Tablets
Udev property | Value |
DRIVER | wacom |
Genius Tablets (e.g. W8060U)
Udev property | Value |
ID_CLASS | mouse |
ID_TYPE | hid |
SUBSYSTEM | input |
ID_MODEL | …(T/t)ablet… |
Other devices
Sound cards
Udev property | Value |
ID_TYPE | audio |
SUBSYSTEM | sound |
Webcams
Udev property | Value |
SUBSYSTEM | video4linux |
Smartphones (not in mass storage mode)
Nokia
Udev property | Value |
DRIVER | cdc_phonet |
Sony
Udev property | Value |
DRIVER | cdc_amn |
Order in which devices are checked
thunar-volman with HAL
Bold means: implemented in the new thunar-volman version based on udev/GIO.
Filtering based on capabilities:
block
camera
input.keyboard (run command)
input.mouse (run command)
input.tablet (run command)
pda
printer (run command)
Block devices:
CD-ROM:
blank disc (run burn software command)
mixed audio/data discs (play or continue with mounting)
audio discs (play)
data discs (continue with mounting)
crypto volumes
normal volumes (continue with mounting)
mounting:
iPods (either open music or import photos)
digital photo camera with mass storage (run command)
video CDs/DVDs (run command)
media with .autorun, autorun, autorun.sh (autorun)
media with autorun.exe (via wine) (autorun)
media with .autoopen or autoopen (autorun)
browse media (open thunar)
Camera devices:
ptp or gphoto2 cameras (run command)
PDA devices:
palm (run command)
pocketpc (run command)
Udev info output for selected devices
Blank DVD-R
UDEV_LOG=3
DEVPATH=/devices/pci0000:00/0000:00:1f.1/host3/target3:0:0/3:0:0:0/block/sr0
MAJOR=11
MINOR=0
DEVNAME=/dev/sr0
DEVTYPE=disk
ID_CDROM=1
ID_CDROM_CD_R=1
ID_CDROM_CD_RW=1
ID_CDROM_DVD=1
ID_CDROM_DVD_R=1
ID_CDROM_DVD_RW=1
ID_CDROM_DVD_RAM=1
ID_CDROM_DVD_PLUS_R=1
ID_CDROM_DVD_PLUS_RW=1
ID_CDROM_DVD_PLUS_R_DL=1
ID_CDROM_MRW=1
ID_CDROM_MRW_W=1
ID_CDROM_MEDIA=1
ID_CDROM_MEDIA_DVD_PLUS_R=1
ID_CDROM_MEDIA_STATE=blank
ID_CDROM_MEDIA_SESSION_NEXT=1
ID_CDROM_MEDIA_SESSION_COUNT=1
ID_CDROM_MEDIA_TRACK_COUNT=1
ID_VENDOR=Optiarc
ID_VENDOR_ENC=Optiarc\x20
ID_MODEL=DVD_RW_AD-7910A
ID_MODEL_ENC=DVD\x20RW\x20AD-7910A\x20
ID_REVISION=1.D1
ID_TYPE=cd
ID_BUS=scsi
ID_PATH=pci-0000:00:1f.1-scsi-0:0:0:0
ACL_MANAGE=1
GENERATED=1
DKD_PRESENTATION_NOPOLICY=0
DKD_MEDIA_AVAILABLE=1
DEVLINKS=/dev/block/11:0 /dev/scd0 /dev/disk/by-path/pci-0000:00:1f.1-scsi-0:0:0:0 /dev/cdrom /dev/cdrw /dev/dvd /dev/dvdrw
Blank CD-R
UDEV_LOG=3
DEVPATH=/devices/pci0000:00/0000:00:1f.1/host3/target3:0:0/3:0:0:0/block/sr0
MAJOR=11
MINOR=0
DEVNAME=/dev/sr0
DEVTYPE=disk
ID_CDROM=1
ID_CDROM_CD_R=1
ID_CDROM_CD_RW=1
ID_CDROM_DVD=1
ID_CDROM_DVD_R=1
ID_CDROM_DVD_RW=1
ID_CDROM_DVD_RAM=1
ID_CDROM_DVD_PLUS_R=1
ID_CDROM_DVD_PLUS_RW=1
ID_CDROM_DVD_PLUS_R_DL=1
ID_CDROM_MRW=1
ID_CDROM_MRW_W=1
ID_CDROM_MEDIA=1
ID_CDROM_MEDIA_CD_R=1
ID_CDROM_MEDIA_STATE=blank
ID_CDROM_MEDIA_SESSION_NEXT=1
ID_CDROM_MEDIA_SESSION_COUNT=1
ID_CDROM_MEDIA_TRACK_COUNT=1
ID_VENDOR=Optiarc
ID_VENDOR_ENC=Optiarc\x20
ID_MODEL=DVD_RW_AD-7910A
ID_MODEL_ENC=DVD\x20RW\x20AD-7910A\x20
ID_REVISION=1.D1
ID_TYPE=cd
ID_BUS=scsi
ID_PATH=pci-0000:00:1f.1-scsi-0:0:0:0
ACL_MANAGE=1
GENERATED=1
DKD_PRESENTATION_NOPOLICY=0
DKD_MEDIA_AVAILABLE=1
DEVLINKS=/dev/block/11:0 /dev/scd0 /dev/disk/by-path/pci-0000:00:1f.1-scsi-0:0:0:0 /dev/cdrom /dev/cdrw /dev/dvd /dev/dvdrw