Re: ide cdrom sg like access / rpcmgr ?

Linus Torvalds
2003-11-12T16:33:12Z

On Wed, 12 Nov 2003, Jens Axboe wrote:
>
> To make the below work, all you probably need to do is change sgio() to
> use CDROM_SEND_PACKET for instance. That'll work in 2.4 and 2.6. You
> just need to fill a cdrom_generic_command and send it to the cdrom fd.

Don't forget: you also need to open the device with "O_NONBLOCK", so as to
not make the kernel try to figure out the media etc. Otherwise you can't
do anything with media that the kernel can't figure out (ie empty media
that hasn't been written to, or even no media at all).

Depending on what your tool is for, this may or may not be a problem, of
course. If you only want to send commands to a drive that already has a
readable media in it, you can skip the O_NONBLOCK.

Linus