Alright, I figured out my problem. that particular ioctl puts its information in the return value, and the pointer (third parameter) is set to point to gibberish.
That said, I have a little request for all of you that run some form of Linux (*BSD is not yet supported):
First, if you don't have the basic SDL libraries,
get them. If you've never run h2ph, run it like so:
Code:
# cd /usr/include; find . -name '*.h' -print | xargs h2ph
Next, compile
cd.c with
Code:
cc `sdl-config --cflags` `sdl-config --libs` cd.c
and run the resulting a.out.
Then run perl
readdevs.pl.
Obviously you shouldn't run these if you don't trust me, so here's a description of what they do: The C program utilizes the SDL library to find the number of drives and their names, and then finds the capabilities of each with an ioctl call. The Perl uses one ioctl to find all of the information it needs. Only optical drives respond >0 to that call, and that return value contains all of the capabilities of the drive. Pretty much the only difference is the C program will print how many drives it found, and it will try to find names like /dev/cdrom, while the Perl program prefers names like /dev/dvd.
Please comment back regarding whether or not the output properly described your drive. For the record, it should show every capability of the following that applies to your drive: Writes CD-Rs; Writes CD-RWs; Reads DVDs; Writes DVD-Rs; Writes DVD-RAMs;
There is no capability flag for DVD-RW in the cdrom.h file. Yet.
Thanks.