[Udpcast] predialog doesn't run? eject trouble!

Alain Knaff alain at knaff.lu
Sun Jan 6 20:18:53 CET 2008


Stephane wrote:
[...]
> But there is an error:
> When launching
> 	cd /proc/ide
> I see
> 	/proc/ide: bad directory
> And script stops.
> 
> 
> Solution:
> If I comment line used to eject CD, it is OK.
> My script runs.
> 
> Maybe it would be possible to do something 
> using /proc/sys/dev/cdrom/info or /proc/sys/dev/cdrom/autoeject
> 
> # grep "drive name" /proc/sys/dev/cdrom/info
> drive name:                   hdc
> #
> 
> But 
> # grep "drive name" /proc/sys/dev/cdrom/info | sed -e "s/ //g"
> #
> 
> Troubles with redirections?
> 
> 
> I would like to do something like:
> # grep "drive name" /proc/sys/dev/cdrom/info | tr "\t" " " | sed -e "s/ //g" | 
> cut -d ":" -f2
> 
> 
> Regards.


Indeed, in order to save space, I compiled the kernel without /proc/ide 
support:

config IDE_PROC_FS
         bool "legacy /proc/ide/ support"
         depends on IDE && PROC_FS
         default y
         help
           This option enables support for the various files in
           /proc/ide.  In Linux 2.6 this has been superseded by
           files in sysfs but many legacy applications rely on this.

           If unsure say Y.

As you noted, you can still achieve the same functionality using /sys

One way would for instance be the following command:

fgrep -l cdrom /sys/block/*/device/media |
   sed 's/\/sys\/block\/\(.*\)\/device\/media/\1/'

To be run with today's version, in order to avoid the 
__libc_atexit/--gc-sections bug...

Regards,

Alain



More information about the Udpcast mailing list