[PATCH] Optical disc tracks
Owen Fraser-Green
owen at discobabe.net
Tue Jun 1 14:13:09 PDT 2004
Hi,
Attached is a patch to detect CD/DVD tracks and add them as devices
underneath the disc device. This seemed like a logical step given that a
disk devices have their volumes as children.
It's useful since it provides track position (useful for calculating
CDDB/Musicbrainz IDs and the like) and track length (useful for CD
players).
What I felt a little shaky on though was what to give for
info.capabilities (currently "track"), info.category (currently "track")
and info.product (currently "Track", well, OK that one seems obvious
enough at least).
Here's the relevant output from lshal for three of the tracks (one
leadout, one data and one audio) on the CD currently in my drive:
udi = '/org/freedesktop/Hal/devices/block_22_0-disc/170'
track.is_leadout = true (bool)
track.is_audio = false (bool)
track.is_data = false (bool)
track.is_xa = false (bool)
track.is_cdi = false (bool)
track.address_lsn = 258091 (0x3f02b) (int)
track.address_lba = 257941 (0x3ef95) (int)
track.number = 170 (0xaa) (int)
info.capabilities = 'track' (string)
info.udi = '/org/freedesktop/Hal/devices/block_22_0-disc/170'
(string)
storage.hotpluggable = false (bool)
storage.cdrom.write_speed = 0 (0x0) (int)
storage.cdrom.read_speed = 4234 (0x108a) (int)
storage.cdrom.support_media_changed = true (bool)
storage.cdrom.eject_check_enabled = true (bool)
storage.cdrom.dvdplusrw = false (bool)
storage.cdrom.dvdplusr = false (bool)
storage.cdrom.dvdram = false (bool)
storage.cdrom.dvdr = false (bool)
storage.cdrom.dvd = false (bool)
storage.cdrom.cdrw = false (bool)
storage.cdrom.cdr = false (bool)
storage.removable = true (bool)
storage.drive_type = 'cdrom' (string)
info.product = 'Track' (string)
block.storage_device = '/org/freedesktop/Hal/devices/block_22_0'
(string)
storage.physical_device = '/org/freedesktop/Hal/devices/ide_1_0'
(string)
storage.vendor = '' (string)
storage.model = 'SAMSUNG CD-ROM SN-124' (string)
storage.automount_enabled = true (bool)
storage.media_check_enabled = true (bool)
storage.bus = 'ide' (string)
block.minor = 0 (0x0) (int)
block.major = 22 (0x16) (int)
info.category = 'track' (string)
info.parent = '/org/freedesktop/Hal/devices/block_22_0-disc' (string)
block.device = '/udev/hdc' (string)
block.is_volume = true (bool)
linux.sysfs_path_device = '/sys/block/hdc' (string)
linux.sysfs_path = '/sys/block/hdc' (string)
info.bus = 'block' (string)
volume.label = '' (string)
volume.uuid = '' (string)
volume.fstype = '' (string)
volume.mount_point = '' (string)
volume.is_mounted = false (bool)
volume.is_disc = true (bool)
volume.disc.type = 'unknown' (string)
volume.disc.has_audio = true (bool)
volume.disc.has_data = true (bool)
volume.disc.is_blank = false (bool)
volume.disc.is_appendable = false (bool)
volume.disc.is_rewritable = false (bool)
udi = '/org/freedesktop/Hal/devices/block_22_0-disc/13'
track.length_frames = 66554 (0x103fa) (int)
track.is_leadout = false (bool)
track.is_audio = false (bool)
track.is_data = true (bool)
track.is_xa = false (bool)
track.is_cdi = false (bool)
track.address_lsn = 191537 (0x2ec31) (int)
track.address_lba = 191387 (0x2eb9b) (int)
track.number = 13 (0xd) (int)
info.capabilities = 'track' (string)
info.udi = '/org/freedesktop/Hal/devices/block_22_0-disc/13' (string)
storage.hotpluggable = false (bool)
storage.cdrom.write_speed = 0 (0x0) (int)
storage.cdrom.read_speed = 4234 (0x108a) (int)
storage.cdrom.support_media_changed = true (bool)
storage.cdrom.eject_check_enabled = true (bool)
storage.cdrom.dvdplusrw = false (bool)
storage.cdrom.dvdplusr = false (bool)
storage.cdrom.dvdram = false (bool)
storage.cdrom.dvdr = false (bool)
storage.cdrom.dvd = false (bool)
storage.cdrom.cdrw = false (bool)
storage.cdrom.cdr = false (bool)
storage.removable = true (bool)
storage.drive_type = 'cdrom' (string)
info.product = 'Track' (string)
block.storage_device = '/org/freedesktop/Hal/devices/block_22_0'
(string)
storage.physical_device = '/org/freedesktop/Hal/devices/ide_1_0'
(string)
storage.vendor = '' (string)
storage.model = 'SAMSUNG CD-ROM SN-124' (string)
storage.automount_enabled = true (bool)
storage.media_check_enabled = true (bool)
storage.bus = 'ide' (string)
block.minor = 0 (0x0) (int)
block.major = 22 (0x16) (int)
info.category = 'track' (string)
info.parent = '/org/freedesktop/Hal/devices/block_22_0-disc' (string)
block.device = '/udev/hdc' (string)
block.is_volume = true (bool)
linux.sysfs_path_device = '/sys/block/hdc' (string)
linux.sysfs_path = '/sys/block/hdc' (string)
info.bus = 'block' (string)
volume.label = '' (string)
volume.uuid = '' (string)
volume.fstype = '' (string)
volume.mount_point = '' (string)
volume.is_mounted = false (bool)
volume.is_disc = true (bool)
volume.disc.type = 'unknown' (string)
volume.disc.has_audio = true (bool)
volume.disc.has_data = true (bool)
volume.disc.is_blank = false (bool)
volume.disc.is_appendable = false (bool)
volume.disc.is_rewritable = false (bool)
udi = '/org/freedesktop/Hal/devices/block_22_0-disc/12'
track.length_msn = '5:17:70' (string)
track.length_frames = 23845 (0x5d25) (int)
track.is_leadout = false (bool)
track.is_audio = true (bool)
track.is_data = false (bool)
track.is_xa = false (bool)
track.is_cdi = false (bool)
track.address_lsn = 167692 (0x28f0c) (int)
track.address_lba = 167542 (0x28e76) (int)
track.number = 12 (0xc) (int)
info.capabilities = 'track' (string)
info.udi = '/org/freedesktop/Hal/devices/block_22_0-disc/12' (string)
storage.hotpluggable = false (bool)
storage.cdrom.write_speed = 0 (0x0) (int)
storage.cdrom.read_speed = 4234 (0x108a) (int)
storage.cdrom.support_media_changed = true (bool)
storage.cdrom.eject_check_enabled = true (bool)
storage.cdrom.dvdplusrw = false (bool)
storage.cdrom.dvdplusr = false (bool)
storage.cdrom.dvdram = false (bool)
storage.cdrom.dvdr = false (bool)
storage.cdrom.dvd = false (bool)
storage.cdrom.cdrw = false (bool)
storage.cdrom.cdr = false (bool)
storage.removable = true (bool)
storage.drive_type = 'cdrom' (string)
info.product = 'Track' (string)
block.storage_device = '/org/freedesktop/Hal/devices/block_22_0'
(string)
storage.physical_device = '/org/freedesktop/Hal/devices/ide_1_0'
(string)
storage.vendor = '' (string)
storage.model = 'SAMSUNG CD-ROM SN-124' (string)
storage.automount_enabled = true (bool)
storage.media_check_enabled = true (bool)
storage.bus = 'ide' (string)
block.minor = 0 (0x0) (int)
block.major = 22 (0x16) (int)
info.category = 'track' (string)
info.parent = '/org/freedesktop/Hal/devices/block_22_0-disc' (string)
block.device = '/udev/hdc' (string)
block.is_volume = true (bool)
linux.sysfs_path_device = '/sys/block/hdc' (string)
linux.sysfs_path = '/sys/block/hdc' (string)
info.bus = 'block' (string)
volume.label = '' (string)
volume.uuid = '' (string)
volume.fstype = '' (string)
volume.mount_point = '' (string)
volume.is_mounted = false (bool)
volume.is_disc = true (bool)
volume.disc.type = 'unknown' (string)
volume.disc.has_audio = true (bool)
volume.disc.has_data = true (bool)
volume.disc.is_blank = false (bool)
volume.disc.is_appendable = false (bool)
volume.disc.is_rewritable = false (bool)
Cheers,
Owen
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tracks.patch
Type: text/x-patch
Size: 7573 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/hal/attachments/20040601/725cf454/tracks.bin
-------------- next part --------------
_______________________________________________
hal mailing list
hal at freedesktop.org
http://freedesktop.org/mailman/listinfo/hal
More information about the Hal
mailing list