Re: Udev to burn cd's
On Tue, Jun 05, 2007 at 16:01:12 -0700, JAMES FINSTROM wrote:
> So here is the task
>
> A headless tower running kubuntu 7.04 containing 2 cd burners we will call
> a
> and b.
>
> What i need to accomplish which I imagine can be done with udev and a bash
> script, is that if a user puts a blank cd in drive A udev calls a bash
> script that runs:
>
> cdrecord -v speed=40 dev=0,0,0 Iso_file_a.iso
> eject cdrom0
>
> If a blank cd is placed in drive b we call the following
>
> cdrecord -v speed=40 dev=0,0,1 Iso_file_b.iso
> eject cdrom1
>
> Any thoughts would be appreciated.
>
> We are using this for internal duplication of Trixbox CD's but any result
> of
> this project could likely be adapted to a KIOSK that allows users to insert
> a disk and get their choice of x number of distros...
I don't think udev is involved when you insert CDs into a drive. Udev
just has to make sure that the device node of the CD drive is created in
/dev/ (normally during boot).
You probably need to look into HAL (and maybe DBUS) to achieve what you
want. Try to run "lshal --monitor" and insert an empty CD into the
drive. Here is what I get:
$ lshal --monitor
Start monitoring devicelist:
-------------------------------------------------
09:38:55.289: storage_model_CDRWDVD_TS_H493A property storage.removable.media_available = true
09:38:55.313: storage_model_CDRWDVD_TS_H493A property storage.removable.media_size = 2048 (0x800) (new)
09:38:55.384: volume_empty_cd_r added
<aborted with CTRL-C>
I can check for the presence of (empty) removable media with
hal-get-property --udi /org/freedesktop/Hal/devices/storage_model_CDRWDVD_TS_H493A --key storage.removable.media_available
which returns "true" or "false", or with
$ lshal --show volume_empty_cd_r
volume_empty_cd_r
which returns an empty string if there is no empty CD-R in the drive.
(You probably also have to check for volume_empty_cd_rw to catch
CD-RWs.)
You could run a process which searches every few seconds for the
presence of empty CD-R(W)s and runs the CD burning script if it finds
one. That is probably not the most elegant way to implement it, but I
think it should work. KDE offers a number of ways to interact with HAL
and DBUS, so you will probably find a much nicer way to set up your CD
burning kiosk if you look a bit deeper into that.
--
Regards, | http://users.icfo.es/Florian.Kulzer
Florian |
Reply to: