Re: ide cdrom sg like access / rpcmgr ?

From: Linus Torvalds
Date: Wed Nov 12 2003 - 11:33:53 EST



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

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/