Xfce Wiki

Sub domains
 

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

Removable Media

Udev property Value
DEVTYPE partition
DKD_PARTITION 1
ID_FS_USAGE filesystem
ID_TYPE disk
SUBSYSTEM block

Encrypted Removable Media

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

Multimedia

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

Note: this folder is typically present on an iPod even if it is reflashed with Rockbox. The difference between the original and reflashed iPods is that the original iPod needs special directory hierarchy and a special database file maintained by libgpod, and Rockbox plays anything from any directory without the need to install special programs. Rockbox can be detected by the presence of the .rockbox folder.

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

Input Devices

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

or (Volito 2, Bamboo)

Udev property Value
ID_USB_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.

  1. Filtering based on capabilities:
    1. block
    2. camera
    3. input.keyboard (run command)
    4. input.mouse (run command)
    5. input.tablet (run command)
    6. pda
    7. printer (run command)
  2. Block devices:
    1. CD-ROM:
      1. blank disc (run burn software command)
      2. mixed audio/data discs (play or continue with mounting)
      3. audio discs (play)
      4. data discs (continue with mounting)
    2. crypto volumes
    3. normal volumes (continue with mounting)
    4. mounting:
      1. iPods (either open music or import photos)
      2. digital photo camera with mass storage (run command)
      3. video CDs/DVDs (run command)
      4. media with .autorun, autorun, autorun.sh (autorun)
      5. media with autorun.exe (via wine) (autorun)
      6. media with .autoopen or autoopen (autorun)
      7. browse media (open thunar)
  3. Camera devices:
    1. ptp or gphoto2 cameras (run command)
  4. PDA devices:
    1. palm (run command)
    2. 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

Progress

  • 2010-07-19:
    • Basic code design and skeleton for detecting devices
    • Mount volumes, partitions and data CDs/DVDs and open them in Thunar
    • Play video CDs/DVDs automatically
  • 2010-07-20:
    • Detect blank CDs/DVDs and open the favorite burn software
    • Autorun support (native and autorun.exe in wine)
    • Autoopen support
    • Detect photo content on mass storage cameras and open the favorite photo manager
    • Detect media (audio) players and iPods, launch photo or music manager
    • Detect input devices (keyboard, mouse, tablet) and run a command
  • 2010-07-21:
    • Detect additional wacom tablets (volito, bamboo)
    • Detect printers and run a command
    • Detect gphoto2 cameras (most of which don't have a mass storage mode) and run the photos manager
    • Detect audio and mixed audio/data CDs, ask user what to do, either mount or play the audio CD
    • Verified that encrypted volumes are detected and mounted properly
    • Port the entire settings dialog to the new codebase
  • 2010-07-22:
    • Display notifications when devices are mounted or detected (optional; requires libnotify)
  • 2010-07-23:
    • Thunar: re-implement unmount/eject notifications based on libnotify (optional)
    • Bugfixing
  • 2010-07-24:
    • Bugfixing
  • 2010-07-25:
    • Released Thunar 1.1.1 and thunar-volman 0.5.0 with full support for udev and GIO and no dependency on HAL.
  • 2010-07-26:
    • Released thunar-volman 0.5.1 as a quick follow-up release to fix a critical bug.