Messages in this thread | | | Date | Tue, 7 Sep 1999 13:59:07 +0100 | From | BOSZORMENYI Zoltan <> | Subject | Re: cdrom problem(s) |
| |
Hi!
Your advice to use O_NONBLOCK upon opening /dev/cdrom fixed the cd audio player program, thanks.
But trying to set the CD-ROM spindown time I faced some other problems.
First, I mentioned my cdprobe program in my previous mail. In that program, I used
result = ioctl(fd, CDROM_GET_CAPABILITY); [1]
to get the capabilities of the drive. Experimenting with CDROMGETSPINDOWN and CDROMSETSPINDOWN ioctls, I discovered that to get the spindown setting I have to use
result = ioctl(fd, CDROMGETSPINDOWN, &spindown); [2]
instead of
result = ioctl(fd, CDROMGETSPINDOWN);
and this annoys me a little. Why do the interfaces of [1] and [2] differ? They both return a single numeric value when they succeed. They should look and work the same, shouldn't they?
Second, when I try to set the spindown setting in my program, ftp://ftp.externet.hu/pub/people/zboszor/cdspin.c with
result = ioctl(fd, CDROMSETSPINDOWN, newspindown);
in line 47 I get the following error:
[root@boszi 3]# ./cdspin 15 Trying to get spindown setting... success, 9 Trying to set spindown setting to 15... failure: Bad address
If I change it to
result = ioctl(fd, CDROMSETSPINDOWN, &newspindown);
then I get the following error:
[root@boszi 3]# ./cdspin 15 Trying to get spindown setting... success, 9 hdd: cdrom_pc_intr: Drive wants to transfer data the wrong way! hdd: packet command error: status=0x51 { DriveReady SeekComplete Error } hdd: packet command error: error=0x50 ATAPI device hdd: Error: Illegal request -- (Sense key=0x05) Invalid field in parameter list -- (asc=0x26, ascq=0x00) The failed "Mode Select 10" packet command was: "55 10 0d 00 00 00 00 00 10 00 00 00 " Error in command data byte 36029 Trying to set spindown setting to 15... failure: Input/output error
Which would be the correct code? I suppose that the first one would be the correct one because in my cdprobe program the CD-ROM speed setting is done this way:
result = ioctl(fd, CDROM_SELECT_SPEED, speed);
and this succeeds.
Third, I asked whether the statements about the spindown settings in the hdparm manpage are correct or not. This manpage talks about settings in the range 0 ... 255. But ide-cd.c uses only the lower 4 bits of what it gets (in both CDROMSETSPINDOWN and CDROMGETSPINDOWN). So the hdparm works in another way than ide-cd.c and the settings for hdparm aren't valid for ide-cd. Now, will you please explain what the settings (0 ... 15) mean for the ide-cd ioctls?
All of these were experienced on 2.3.16 patch with both of your cdrom fixes.
Best regards, Zoltan Boszormenyi
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |