2004-11-20 16:18:23

by David Härdeman

[permalink] [raw]
Subject: Is controlling DVD speeds via SET_STREAMING supported?

Hi,

currently my DVD player sounds like a jet plane when playing ordinary
audio CD's. I tried the different approaches to lowering playback speed
that are commonly used (hdparm, setspeed, etc) but none of them worked.

Then I found this thread:
http://marc.theaimsgroup.com/?t=99366299900003&r=1&w=2

Which seems to indicate that DVD players need a different command
(SET_STREAMING), the thread is from 2001, and I've not been able to find
any more recent information.

So, my question is, is this implemented in the kernel and are there any
userspace tools to set the playback speed?

Regards,
David

PS
Please CC replies to my email address...


2004-11-20 16:31:14

by Jan Engelhardt

[permalink] [raw]
Subject: Re: Is controlling DVD speeds via SET_STREAMING supported?

>Hi,
>
>currently my DVD player sounds like a jet plane when playing ordinary
>audio CD's. I tried the different approaches to lowering playback speed
>that are commonly used (hdparm, setspeed, etc) but none of them worked.

I doubt hdparm works on CD/DVD drives.
What is setspeed doing, internally?

My CD drives spin at "normal" (no more than speed 8) when playing CD-DA,
if I am listening to Ogg, I manually spin it down by using "calm-cdrom".
( http://linux01.org:2222/f/UHXT/sbin/src/calm-cdrom.c )

>Then I found this thread:
>http://marc.theaimsgroup.com/?t=99366299900003&r=1&w=2

BTW, I can't spindown CD-DA, because upon opening /dev/hdb for the ioctl, the
cd player resets :)



Jan Engelhardt
--
Gesellschaft für Wissenschaftliche Datenverarbeitung
Am Fassberg, 37077 Göttingen, http://www.gwdg.de

2004-11-20 16:45:47

by David Härdeman

[permalink] [raw]
Subject: Re: Is controlling DVD speeds via SET_STREAMING supported?

On Sat, Nov 20, 2004 at 05:30:54PM +0100, Jan Engelhardt wrote:
>I doubt hdparm works on CD/DVD drives.
>What is setspeed doing, internally?

Well, hdparm does work for CD drives (hdparm -E), but not for CD/DVD
combo drives...

And also, the tools I was thinking of isn't called setspeed...it's called
setcd, and it uses ioctl(fd, CDROM_SELECT_SPEED, speed) which doesn't
work on DVD players apparently. The same goes for the other tools I've
tested ("hdparm -E" and "eject -x").

>
>My CD drives spin at "normal" (no more than speed 8) when playing CD-DA,
>if I am listening to Ogg, I manually spin it down by using "calm-cdrom".
>( http://linux01.org:2222/f/UHXT/sbin/src/calm-cdrom.c )

Which also uses the above mentioned ioctl...

Re,
David

2004-11-20 20:20:35

by Jens Axboe

[permalink] [raw]
Subject: Re: Is controlling DVD speeds via SET_STREAMING supported?

On Sat, Nov 20 2004, David H?rdeman wrote:
> Hi,
>
> currently my DVD player sounds like a jet plane when playing ordinary
> audio CD's. I tried the different approaches to lowering playback speed
> that are commonly used (hdparm, setspeed, etc) but none of them worked.
>
> Then I found this thread:
> http://marc.theaimsgroup.com/?t=99366299900003&r=1&w=2
>
> Which seems to indicate that DVD players need a different command
> (SET_STREAMING), the thread is from 2001, and I've not been able to find
> any more recent information.
>
> So, my question is, is this implemented in the kernel and are there any
> userspace tools to set the playback speed?

I don't know of any, but it is trival to write using SG_IO (or just
CDROM_SEND_PACKET for this simple use, since only a trivial amount of
data involved). If you are not sure how to do it, let me know and I can
easily write one in minutes.

--
Jens Axboe

2004-11-20 23:56:06

by David Härdeman

[permalink] [raw]
Subject: Re: Is controlling DVD speeds via SET_STREAMING supported?

On Sat, Nov 20, 2004 at 09:19:45PM +0100, Jens Axboe wrote:
>On Sat, Nov 20 2004, David H?rdeman wrote:
>> So, my question is, is this implemented in the kernel and are there any
>> userspace tools to set the playback speed?
>
>I don't know of any, but it is trival to write using SG_IO (or just
>CDROM_SEND_PACKET for this simple use, since only a trivial amount of
>data involved). If you are not sure how to do it, let me know and I can
>easily write one in minutes.

If you could write up a quick-n-dirty tool, it would be great! Based
on that I could hopefully write a patch later for one of the common
tools (eg. hdparm or setcd).

Re?
David

2004-11-25 00:35:13

by Thomas Fritzsche

[permalink] [raw]
Subject: Re: Re: Is controlling DVD speeds via SET_STREAMING supported?

Hi David,

I had the same problem with my DVD+-RW NEC-ND 3500 (NEC-support told me
that they didn't support linux :-( ). After googling I couldn't find an
answer. Because I didn't know anything about ide-cd (yesterday ;-)) I
read in this spec about the SET STREAMING command:
ftp://ftp.avc-pioneer.com/Mtfuji_4/Spec/Fuji4r10.pdf
If you also read the newer Specs (Mtfuji_5) then you'll find out that the
"SET CD SPEED" command is "only applicable to CD-R/RW logical units".
It looks like older DVD-Drives also support this command, but newer do not
support this for DVD+-R. But there is also the SET STREAMING command as
Jens Axboe described on this list. Not all devices support this feature
but my NEC-CD 3500 does (as I found out ;-) / my Teac-CD-RW does not)

I wrote a little programm to test this SET STREAMING command (quick &
dirty). In my opinion it would make sence to also enhance the kernel
function cdrom_select_speed (linux/drivers/ide/ide-cd.c), so that this
function works also for "newer" DVD-drives.
(!first check for the Realtime-Streaming-Feature and then use the right
command to set the speed). Because DVD+-RW Drives will be faster (AND
LOUDER!!) very soon it would be nice to have this in the kernel.

Thanks and regards,
Thomas Fritzsche

PS.: I'm not subscribed to LKML please CC me If you would like to discuss
this issue.

-----------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <string.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <linux/cdrom.h>

/*
* speed - use SET STREAMING command to set the speed of DVD-drives
*
*
* Copyright (c) 2004 Thomas Fritzsche <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/

void dump_sense(unsigned char *cdb, struct request_sense *sense)
{
int i;

printf("Command failed: ");

for (i=0; i<12; i++)
printf("%02x ", cdb[i]);

if (sense) {
printf(" - sense: %02x.%02x.%02x\n", sense->sense_key, sense->asc,
sense->ascq);
} else {
printf(", no sense\n");
}
}

int main(int argc, char *argv[])
{
int fd = open("/dev/hdc", O_RDONLY | O_NONBLOCK);
int c;
int speed = 0;
unsigned char buffer[28];

struct cdrom_generic_command cgc;
struct request_sense sense;
extern char * optarg;

while((c=getopt(argc,argv,"x:"))!=EOF) {
switch(c) {
case 'x': speed = atoi(optarg); break;
default:
printf("Usage: speed -x <speed>");
exit(-1);
}
}

memset(&cgc, 0, sizeof(cgc));
memset(&sense, 0, sizeof(sense));
memset(&buffer, 0, sizeof(buffer));

/* SET STREAMING command */
cgc.cmd[0] = 0xb6;
/* 28 byte parameter list length */
cgc.cmd[10] = 28;

cgc.sense = &sense;
cgc.buffer = buffer;
cgc.buflen = sizeof(buffer);
cgc.data_direction = CGC_DATA_WRITE;

buffer[8] = 0xff;
buffer[9] = 0xff;
buffer[10] = 0xff;
buffer[11] = 0xff;

buffer[15] = 177*speed;
buffer[18] = 0x03;
buffer[19] = 0xE8;

buffer[23] = 177*speed;
buffer[26] = 0x03;
buffer[27] = 0xE8;



if (ioctl(fd, CDROM_SEND_PACKET, &cgc) == 0) {
printf("OK\n");
return 0;
} else
{
printf("error!\n");
dump_sense(cgc.cmd, cgc.sense);
return -1;
}
}


-----------------------------------------

----------------------------------------------------------
Date Sun, 21 Nov 2004 00:50:32 +0100
From David H?rdeman <>
Subject Re: Is controlling DVD speeds via SET_STREAMING supported?

On Sat, Nov 20, 2004 at 09:19:45PM +0100, Jens Axboe wrote:
>On Sat, Nov 20 2004, David H?rdeman wrote:
>> So, my question is, is this implemented in the kernel and are there any
>> userspace tools to set the playback speed?
>
>I don't know of any, but it is trival to write using SG_IO (or just
>CDROM_SEND_PACKET for this simple use, since only a trivial amount of
>data involved). If you are not sure how to do it, let me know and I can
>easily write one in minutes.

If you could write up a quick-n-dirty tool, it would be great! Based
on that I could hopefully write a patch later for one of the common
tools (eg. hdparm or setcd).

Re?
David

2004-11-25 07:57:21

by Jens Axboe

[permalink] [raw]
Subject: Re: Re: Is controlling DVD speeds via SET_STREAMING supported?

On Wed, Nov 24 2004, Thomas Fritzsche wrote:
> Hi David,
>
> I had the same problem with my DVD+-RW NEC-ND 3500 (NEC-support told me
> that they didn't support linux :-( ). After googling I couldn't find an
> answer. Because I didn't know anything about ide-cd (yesterday ;-)) I
> read in this spec about the SET STREAMING command:
> ftp://ftp.avc-pioneer.com/Mtfuji_4/Spec/Fuji4r10.pdf
> If you also read the newer Specs (Mtfuji_5) then you'll find out that the
> "SET CD SPEED" command is "only applicable to CD-R/RW logical units".
> It looks like older DVD-Drives also support this command, but newer do not
> support this for DVD+-R. But there is also the SET STREAMING command as
> Jens Axboe described on this list. Not all devices support this feature
> but my NEC-CD 3500 does (as I found out ;-) / my Teac-CD-RW does not)
>
> I wrote a little programm to test this SET STREAMING command (quick &
> dirty). In my opinion it would make sence to also enhance the kernel
> function cdrom_select_speed (linux/drivers/ide/ide-cd.c), so that this
> function works also for "newer" DVD-drives.
> (!first check for the Realtime-Streaming-Feature and then use the right
> command to set the speed). Because DVD+-RW Drives will be faster (AND
> LOUDER!!) very soon it would be nice to have this in the kernel.

I agree, I'll do a patch for this right now. Your example code looks
fine. My only worry is that some drives might complain if your end_lba
is larger than the capacity, I'll have to double check the spec.

--
Jens Axboe

2004-11-26 22:18:21

by Thomas Fritzsche

[permalink] [raw]
Subject: Re: Re: Is controlling DVD speeds via SET_STREAMING supported?

Hi Jens,

absolute correct! I just tested it with speed = 1 yesterday night
(quick&duty). This is just a code snap to show that it's possible to set
the speed of a DVD drive this way.

You also wrote about the "End LBA" field in your other mail.
I set this to 0xffffffff but you think that this could be a problem if the
device don't have this LBA. The spec only writes this:
"The End LBA field is the last logical block for which the performance
request is being made." So it should be standard conform if we set here a
higher block number. Do you have experience with other (than NEC ND-3500)
drive that don't support this?

Using this high last block number would make sence, because it looks like
this setting is still valid if the media is changed (other end block!?).

Spec:
"The performance setting is persistent and remains until a new descriptor
is sent. The setting only applies to the extent
identified by the Start and End LBA field. Only zero or one performance
extents shall be valid at any time."

What do you think?

I also found out, that the Realtime-Streaming Feature is mandatory for all
kinds of DVD-+R+-RW-RAM drives. So it might be sufficient to simply use
SET STREAMING for DVD drives and SET SPEED for CD-R's. Isn't it?

I will also enhance this tool by setting the RDD flag if the user selects
speed = 0.

Thanks and kind regards,
Thomas Fritzsche

> I should have read this more closely... You need to fill the speed
fields correctly:
>
> unsigned long read_size = 177 * speed;
>
> buffer[12] = (read_size >> 24) & 0xff;
> buffer[13] = (read_size >> 16) & 0xff;
> buffer[14] = (read_size >> 8) & 0xff;
> buffer[15] = read_size & 0xff;
>
> Ditto for write size.
>
> --
> Jens Axboe
>
>




2004-11-27 07:06:14

by Thomas Fritzsche

[permalink] [raw]
Subject: Re: Re: Is controlling DVD speeds via SET_STREAMING supported?

Hi Jens,

absolute correct! I just tested it with speed = 1 yesterday night
(quick&duty). This is just a code snap to show that it's possible to set
the speed of a DVD drive this way.

You also wrote about the "End LBA" field in your other mail.
I set this to 0xffffffff but you think that this could be a problem if the
device don't have this LBA. The spec only writes this:
"The End LBA field is the last logical block for which the performance
request is being made." So it should be standard conform if we set here a
higher block number. Do you have experience with other (than NEC ND-3500)
drive that don't support this?

Using this high last block number would make sence, because it looks like
this setting is still valid if the media is changed (other end block!?).

Spec:
"The performance setting is persistent and remains until a new descriptor
is sent. The setting only applies to the extent
identified by the Start and End LBA field. Only zero or one performance
extents shall be valid at any time."

What do you think?

I also found out, that the Realtime-Streaming Feature is mandatory
for all kinds of DVD-+R+-RW-RAM drives. So it might be sufficient to
simply use SET STREAMING for DVD drives and SET SPEED for CD-R's. Isn't
it?

I will also enhance this tool by setting the RDD flag if the user selects
speed = 0.

Thanks and kind regards,
Thomas Fritzsche

> I should have read this more closely... You need to fill the speed
> fields correctly:
>
> unsigned long read_size = 177 * speed;
>
> buffer[12] = (read_size >> 24) & 0xff;
> buffer[13] = (read_size >> 16) & 0xff;
> buffer[14] = (read_size >> 8) & 0xff;
> buffer[15] = read_size & 0xff;
>
> Ditto for write size.
>
> --
> Jens Axboe
>
>


2004-11-27 06:58:02

by Jens Axboe

[permalink] [raw]
Subject: Re: Re: Is controlling DVD speeds via SET_STREAMING supported?

On Wed, Nov 24 2004, Thomas Fritzsche wrote:
> /* SET STREAMING command */
> cgc.cmd[0] = 0xb6;
> /* 28 byte parameter list length */
> cgc.cmd[10] = 28;
>
> cgc.sense = &sense;
> cgc.buffer = buffer;
> cgc.buflen = sizeof(buffer);
> cgc.data_direction = CGC_DATA_WRITE;
>
> buffer[8] = 0xff;
> buffer[9] = 0xff;
> buffer[10] = 0xff;
> buffer[11] = 0xff;
>
> buffer[15] = 177*speed;
> buffer[18] = 0x03;
> buffer[19] = 0xE8;

I should have read this more closely... You need to fill the speed
fields correctly:

unsigned long read_size = 177 * speed;

buffer[12] = (read_size >> 24) & 0xff;
buffer[13] = (read_size >> 16) & 0xff;
buffer[14] = (read_size >> 8) & 0xff;
buffer[15] = read_size & 0xff;

Ditto for write size.

--
Jens Axboe

2004-11-27 11:55:51

by Thomas Fritzsche

[permalink] [raw]
Subject: Re: Re: Is controlling DVD speeds via SET_STREAMING supported?

Hi Jens,

I build a new version that addresse this issues.

Usage: speed -x <speed> <device>
(speed = 0 means reset to defaults)

Cheers,
Thomas Fritzsche

http://noto.de/vdr/speed-1.0.c
-------------------------------------------------------
/*
* speed - use SET STREAMING command to set the speed of DVD-drives
*
*
* Copyright (c) 2004 Thomas Fritzsche <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/

#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <string.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <linux/cdrom.h>


void dump_sense(unsigned char *cdb, struct request_sense *sense)
{
int i;

printf("Command failed: ");

for (i=0; i<12; i++)
printf("%02x ", cdb[i]);

if (sense) {
printf(" - sense: %02x.%02x.%02x\n", sense->sense_key, sense->asc,
sense->ascq);
} else {
printf(", no sense\n");
}
}

int main(int argc, char *argv[])
{
char *device = "/dev/cdrom";
int c,fd;
int speed = 0;
unsigned long rw_size;

unsigned char buffer[28];

struct cdrom_generic_command cgc;
struct request_sense sense;
extern char * optarg;

while((c=getopt(argc,argv,"x:"))!=EOF) {
switch(c) {
case 'x': speed = atoi(optarg); break;
default:
printf("Usage: speed [-x speed] [device]");
return -1;
}
}

if (argc > optind) device = argv[optind];

fd = open(device, O_RDONLY | O_NONBLOCK);
if (fd < 0) {
printf("Can't open device %s\n", device);
return -1;
}


memset(&cgc, 0, sizeof(cgc));
memset(&sense, 0, sizeof(sense));
memset(&buffer, 0, sizeof(buffer));

/* SET STREAMING command */
cgc.cmd[0] = 0xb6;
/* 28 byte parameter list length */
cgc.cmd[10] = 28;

cgc.sense = &sense;
cgc.buffer = buffer;
cgc.buflen = sizeof(buffer);
cgc.data_direction = CGC_DATA_WRITE;
cgc.quiet = 1;

if(speed == 0) {
/* set Restore Drive Defaults */
buffer[0] = 4;
}

buffer[8] = 0xff;
buffer[9] = 0xff;
buffer[10] = 0xff;
buffer[11] = 0xff;

rw_size = 177 * speed;

/* read size */
buffer[12] = (rw_size >> 24) & 0xff;
buffer[13] = (rw_size >> 16) & 0xff;
buffer[14] = (rw_size >> 8) & 0xff;
buffer[15] = rw_size & 0xff;

/* read time 1 sec. */
buffer[18] = 0x03;
buffer[19] = 0xE8;

/* write size */
buffer[20] = (rw_size >> 24) & 0xff;
buffer[21] = (rw_size >> 16) & 0xff;
buffer[22] = (rw_size >> 8) & 0xff;
buffer[23] = rw_size & 0xff;

/* write time 1 sec. */
buffer[26] = 0x03;
buffer[27] = 0xE8;

if (ioctl(fd, CDROM_SEND_PACKET, &cgc) != 0)
if (ioctl(fd, CDROM_SELECT_SPEED, speed) != 0) {
dump_sense(cgc.cmd, cgc.sense);
printf("ERROR.\n");
return -1;
}
printf("OK...\n");
return 0;
}
-------------------------------------------------------

> Hi Jens,
>
> absolute correct! I just tested it with speed = 1 yesterday night
> (quick&duty). This is just a code snap to show that it's possible to set
> the speed of a DVD drive this way.
>
> You also wrote about the "End LBA" field in your other mail.
> I set this to 0xffffffff but you think that this could be a problem if the
> device don't have this LBA. The spec only writes this:
> "The End LBA field is the last logical block for which the performance
> request is being made." So it should be standard conform if we set here a
> higher block number. Do you have experience with other (than NEC ND-3500)
> drive that don't support this?
>
> Using this high last block number would make sence, because it looks like
> this setting is still valid if the media is changed (other end block!?).
>
> Spec:
> "The performance setting is persistent and remains until a new descriptor
> is sent. The setting only applies to the extent
> identified by the Start and End LBA field. Only zero or one performance
> extents shall be valid at any time."
>
> What do you think?
>
> I also found out, that the Realtime-Streaming Feature is mandatory for all
> kinds of DVD-+R+-RW-RAM drives. So it might be sufficient to simply use
> SET STREAMING for DVD drives and SET SPEED for CD-R's. Isn't it?
>
> I will also enhance this tool by setting the RDD flag if the user selects
> speed = 0.
>
> Thanks and kind regards,
> Thomas Fritzsche
>
>> I should have read this more closely... You need to fill the speed
> fields correctly:
>>
>> unsigned long read_size = 177 * speed;
>>
>> buffer[12] = (read_size >> 24) & 0xff;
>> buffer[13] = (read_size >> 16) & 0xff;
>> buffer[14] = (read_size >> 8) & 0xff;
>> buffer[15] = read_size & 0xff;
>>
>> Ditto for write size.
>>
>> --
>> Jens Axboe
>>
>>
>
>
>
>


2004-11-27 20:58:08

by Pasi Savolainen

[permalink] [raw]
Subject: Re: Is controlling DVD speeds via SET_STREAMING supported?

* Thomas Fritzsche <[email protected]>:
> Hi Jens,
>
> I build a new version that addresse this issues.
>
> Usage: speed -x <speed> <device>
> (speed = 0 means reset to defaults)

Tried, didn't work. If there's some other info you need,
please tell me.

Thanks.


# ./dvdspeed /dev/dvd
Command failed: b6 00 00 00 00 00 00 00 00 00 1c 00 - sense: 05.20.00
ERROR.

# hdparm -i /dev/dvd

/dev/dvd:

Model=SAMSUNG DVD-ROM SD-616E, FwRev=F502, SerialNo=
Config={ Fixed Removeable DTR<=5Mbs DTR>10Mbs nonMagnetic }
RawCHS=0/0/0, TrkSize=0, SectSize=0, ECCbytes=0
BuffType=unknown, BuffSize=0kB, MaxMultSect=0
(maybe): CurCHS=0/0/0, CurSects=0, LBA=yes, LBAsects=0
IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
PIO modes: pio0 pio1 pio2 pio3 pio4
DMA modes: sdma0 sdma1 sdma2 mdma0 mdma1 mdma2
UDMA modes: udma0 udma1 *udma2
AdvancedPM=no
Drive conforms to: device does not report version:

* signifies the current active mode

# tail -f /var/log/messages
...
Nov 27 22:52:49 tienel kernel: hdb: packet command error: status=0x51 { DriveReady SeekComplete Error }
Nov 27 22:52:49 tienel kernel: hdb: packet command error: error=0x54
Nov 27 22:52:49 tienel kernel: ide: failed opcode was 100


--
Psi -- <http://www.iki.fi/pasi.savolainen>

2004-11-27 21:02:18

by Jan Engelhardt

[permalink] [raw]
Subject: Re: Is controlling DVD speeds via SET_STREAMING supported?


So as a general question (since I am about to finally buy me a DVD drive),
is there a way to slow down the disc speed of DVD drives, like it is for CD?



Jan Engelhardt
--
Gesellschaft für Wissenschaftliche Datenverarbeitung
Am Fassberg, 37077 Göttingen, http://www.gwdg.de

2004-11-28 01:18:30

by Thomas Fritzsche

[permalink] [raw]
Subject: Re: Is controlling DVD speeds via SET_STREAMING supported?

Hi Pasi,

the error message you receive means that your device don't support the SET
STREAMING command. But I'm wondering because an other user reported
success with exactly the DVD model you have. Do you use the latest FW? Do
you have any other special software / hardware setup that could explain
this difference?
What Kernel do you use?
I'm still testing on 2.4.27'er kernel.

Thanks for the feedback and regards,
Thomas



> * Thomas Fritzsche <[email protected]>:
>> Hi Jens,
>>
>> I build a new version that addresse this issues.
>>
>> Usage: speed -x <speed> <device>
>> (speed = 0 means reset to defaults)
>
> Tried, didn't work. If there's some other info you need,
> please tell me.
>
> Thanks.
>
>
> # ./dvdspeed /dev/dvd
> Command failed: b6 00 00 00 00 00 00 00 00 00 1c 00 - sense: 05.20.00
> ERROR.
>
> # hdparm -i /dev/dvd
>
> /dev/dvd:
>
> Model=SAMSUNG DVD-ROM SD-616E, FwRev=F502, SerialNo=
> Config={ Fixed Removeable DTR<=5Mbs DTR>10Mbs nonMagnetic }
> RawCHS=0/0/0, TrkSize=0, SectSize=0, ECCbytes=0
> BuffType=unknown, BuffSize=0kB, MaxMultSect=0
> (maybe): CurCHS=0/0/0, CurSects=0, LBA=yes, LBAsects=0
> IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
> PIO modes: pio0 pio1 pio2 pio3 pio4
> DMA modes: sdma0 sdma1 sdma2 mdma0 mdma1 mdma2
> UDMA modes: udma0 udma1 *udma2
> AdvancedPM=no
> Drive conforms to: device does not report version:
>
> * signifies the current active mode
>
> # tail -f /var/log/messages
> ...
> Nov 27 22:52:49 tienel kernel: hdb: packet command error: status=0x51 {
> DriveReady SeekComplete Error }
> Nov 27 22:52:49 tienel kernel: hdb: packet command error: error=0x54
> Nov 27 22:52:49 tienel kernel: ide: failed opcode was 100
>
>
> --
> Psi -- <http://www.iki.fi/pasi.savolainen>
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
>


2004-11-28 11:18:14

by Pasi Savolainen

[permalink] [raw]
Subject: Re: Is controlling DVD speeds via SET_STREAMING supported?

* Thomas Fritzsche <[email protected]>:
> the error message you receive means that your device don't support the SET
> STREAMING command. But I'm wondering because an other user reported
> success with exactly the DVD model you have. Do you use the latest FW? Do
> you have any other special software / hardware setup that could explain
> this difference?

I updated firmware today to F506 (from F502). Same answer as before.

FWIW, the drive doesn't support setcd -command either.

> What Kernel do you use?

Linux tienel 2.6.10-rc2-mm1 #1 SMP Wed Nov 17 01:19:53 EET 2004 i686 GNU/Linux

Actually now that I rebooted (for DVD flashing) and started back into
linux, after running dvdspeed it also says:
"scsi: unknown opcode 0xb6" (which is SET_STREAMING). Code for this is
in drivers/block/scsi_ioctl.c, and if I read it right, it can't prevent
root from executing that command.

I modified your speed-1.0 to open device O_RDWR, didn't help.
I modified it to also dump_sense after CMD_SEND_PACKET, it's just
duplicate packet.


Thanks.
--
Psi -- <http://www.iki.fi/pasi.savolainen>

2004-11-28 16:29:38

by Thomas Fritzsche

[permalink] [raw]
Subject: Re: Is controlling DVD speeds via SET_STREAMING supported?

Hi,

(please CC me because I'm not subscribed to the list)

>> What Kernel do you use?
>
> Linux tienel 2.6.10-rc2-mm1 #1 SMP Wed Nov 17 01:19:53 EET 2004 i686
> GNU/Linux

Maybe you can give a 2.4.27'er kernel a try.

>
> Actually now that I rebooted (for DVD flashing) and started back into
> linux, after running dvdspeed it also says:
> "scsi: unknown opcode 0xb6" (which is SET_STREAMING). Code for this is
> in drivers/block/scsi_ioctl.c, and if I read it right, it can't prevent
> root from executing that command.

I have the same impression after reading drivers/block/scsi_ioctl.c . I
think you will need root permission to send this command, RW-Permission
for the device file is not enough! Did you try this as root?

But I'm wondering that scsi_ioctl.c comes into play, because It's a
ATAPI-Device. Isn't it? Do you use the scsi emulation? If so please try
without.

>
> I modified your speed-1.0 to open device O_RDWR, didn't help.
> I modified it to also dump_sense after CMD_SEND_PACKET, it's just
> duplicate packet.

No this will definitively not solve this issue. I will try to check this
in the kernel, but because I'm not a kernel developer I will CC Jens
Axboe. Maybe he can help?

Kind Regards,
Thomas Fritzsche

2004-11-28 16:59:08

by Jens Axboe

[permalink] [raw]
Subject: Re: Is controlling DVD speeds via SET_STREAMING supported?

On Sun, Nov 28 2004, Thomas Fritzsche wrote:
> Hi,
>
> (please CC me because I'm not subscribed to the list)
>
> >> What Kernel do you use?
> >
> > Linux tienel 2.6.10-rc2-mm1 #1 SMP Wed Nov 17 01:19:53 EET 2004 i686
> > GNU/Linux
>
> Maybe you can give a 2.4.27'er kernel a try.
>
> >
> > Actually now that I rebooted (for DVD flashing) and started back into
> > linux, after running dvdspeed it also says:
> > "scsi: unknown opcode 0xb6" (which is SET_STREAMING). Code for this is
> > in drivers/block/scsi_ioctl.c, and if I read it right, it can't prevent
> > root from executing that command.
>
> I have the same impression after reading drivers/block/scsi_ioctl.c . I
> think you will need root permission to send this command, RW-Permission
> for the device file is not enough! Did you try this as root?

You just need to add SET_STREAMINIG as a write-safe command, then it
will work as a regular user. Hmm, it is already added as write safe. You
don't have write permission on the device, then.

> But I'm wondering that scsi_ioctl.c comes into play, because It's a
> ATAPI-Device. Isn't it? Do you use the scsi emulation? If so please try
> without.

The 'scsi' in the name doesn't refer to the transport used, but the
command set being scsi-like. ide-scsi emulation has nothing to do with
it.

> > I modified your speed-1.0 to open device O_RDWR, didn't help.
> > I modified it to also dump_sense after CMD_SEND_PACKET, it's just
> > duplicate packet.
>
> No this will definitively not solve this issue. I will try to check this
> in the kernel, but because I'm not a kernel developer I will CC Jens
> Axboe. Maybe he can help?

Just fix the permission on the special file. Additionally, the program
must open the device O_RDWR.

--
Jens Axboe

2004-11-28 17:49:25

by Pasi Savolainen

[permalink] [raw]
Subject: Re: Is controlling DVD speeds via SET_STREAMING supported?

* Jens Axboe <[email protected]>:
>> > I modified your speed-1.0 to open device O_RDWR, didn't help.
>> > I modified it to also dump_sense after CMD_SEND_PACKET, it's just
>> > duplicate packet.
>>
>> No this will definitively not solve this issue. I will try to check this
>> in the kernel, but because I'm not a kernel developer I will CC Jens
>> Axboe. Maybe he can help?
>
> Just fix the permission on the special file. Additionally, the program
> must open the device O_RDWR.

(under 2.6.10-rc2-mm1)
I ran speed-1.0 program as root and also modified to open the device
file as O_RDWR. This didn't help, it still reports same error.

Booted into 2.4.28, speed-1.0 didn't do the trick there either. 'sense'
reported was 00.00.00 though.


--
Psi -- <http://www.iki.fi/pasi.savolainen>

2004-11-28 18:54:38

by Thomas Fritzsche

[permalink] [raw]
Subject: Re: Is controlling DVD speeds via SET_STREAMING supported?

Hi Parsi,

I updated the program to use O_RDWR ( http://noto.de/speed/speedcontrol.c )
and tested it with 2.6.10-rc1, but it's always works fine for me (also
with O_RDONLY / this should only prevents you sending command to the
device without permissions).

Sorry I'm running out of ideas :-(. Maybe your device do not support the
SET STREAMING command!? But if you received this sence message it means
that your device also do also not support the "classic"
ioctl(fd, CDROM_SELECT_SPEED, speed) call. Strange!
Do you have a media in the drive? What?
Do you also receive error messages with setcd -x [device]?

Thanks and regards,
Thomas Fritzsche

> [This message has also been posted to gmane.linux.kernel.]
> * Jens Axboe <[email protected]>:
>>> > I modified your speed-1.0 to open device O_RDWR, didn't help.
>>> > I modified it to also dump_sense after CMD_SEND_PACKET, it's just
>>> > duplicate packet.
>>>
>>> No this will definitively not solve this issue. I will try to check
>>> this
>>> in the kernel, but because I'm not a kernel developer I will CC Jens
>>> Axboe. Maybe he can help?
>>
>> Just fix the permission on the special file. Additionally, the program
>> must open the device O_RDWR.
>
> (under 2.6.10-rc2-mm1)
> I ran speed-1.0 program as root and also modified to open the device
> file as O_RDWR. This didn't help, it still reports same error.
>
> Booted into 2.4.28, speed-1.0 didn't do the trick there either. 'sense'
> reported was 00.00.00 though.
>
>
> --
> Psi -- <http://www.iki.fi/pasi.savolainen>
>


2004-11-28 18:54:04

by Jens Axboe

[permalink] [raw]
Subject: Re: Is controlling DVD speeds via SET_STREAMING supported?


(don't trim the cc list, please!!)

On Sun, Nov 28 2004, Pasi Savolainen wrote:
> * Jens Axboe <[email protected]>:
> >> > I modified your speed-1.0 to open device O_RDWR, didn't help.
> >> > I modified it to also dump_sense after CMD_SEND_PACKET, it's just
> >> > duplicate packet.
> >>
> >> No this will definitively not solve this issue. I will try to check this
> >> in the kernel, but because I'm not a kernel developer I will CC Jens
> >> Axboe. Maybe he can help?
> >
> > Just fix the permission on the special file. Additionally, the program
> > must open the device O_RDWR.
>
> (under 2.6.10-rc2-mm1)
> I ran speed-1.0 program as root and also modified to open the device
> file as O_RDWR. This didn't help, it still reports same error.

Ehm I don't see how that is possible, since that kernel definitely
contains SET_STREAMING as a write safe command. Are you 110% sure you
are running the kernel you think you are?

> Booted into 2.4.28, speed-1.0 didn't do the trick there either. 'sense'
> reported was 00.00.00 though.

Any dmesg errors from 2.4.28? The sense reporting might be a bit broken
there, but if you don't set cgc->quiet it should report the error in the
kernel ring buffer at least.

--
Jens Axboe

2004-11-28 21:01:43

by Pasi Savolainen

[permalink] [raw]
Subject: Re: Is controlling DVD speeds via SET_STREAMING supported?

On Sun, 28 Nov 2004 19:53:30 +0100, Jens Axboe <[email protected]> wrote:
> > (under 2.6.10-rc2-mm1)
> > I ran speed-1.0 program as root and also modified to open the device
> > file as O_RDWR. This didn't help, it still reports same error.
>
> Ehm I don't see how that is possible, since that kernel definitely
> contains SET_STREAMING as a write safe command. Are you 110% sure you
> are running the kernel you think you are?

I was talking about 'feature not suppoerted by device' -error.
Got uptodate to 2.6.10-rc2-mm3, ran following:
- -
tienel:~# whoami
root
tienel:~# uname -a
Linux tienel 2.6.10-rc2-mm3 #1 SMP Sun Nov 28 22:28:17 EET 2004 i686 GNU/Linux
tienel:~# wget -q http://noto.de/speed/speedcontrol.c
tienel:~# gcc -o speedcontrol speedcontrol.c
tienel:~# ./speedcontrol -x 1 /dev/dvd
Command failed: b6 00 00 00 00 00 00 00 00 00 1c 00 - sense: 05.20.00
ERROR.
tienel:~# tail /var/log/messages
...
Nov 28 22:50:04 tienel kernel: hdb: packet command error: status=0x51
{ DriveReady SeekComplete Error }
Nov 28 22:50:04 tienel kernel: hdb: packet command error: error=0x54
Nov 28 22:50:04 tienel kernel: ide: failed opcode was 100
tienel:~# hdparm -I /dev/dvd

/dev/dvd:

ATAPI CD-ROM, with removable media
Model Number: SAMSUNG DVD-ROM SD-616E
Serial Number:
Firmware Revision: F506
Standards:
Used: ATAPI for CD-ROMs, SFF-8020i, r2.5
Supported: CD-ROM ATAPI-2
Configuration:
DRQ response: 50us.
Packet size: 12 bytes
Capabilities:
LBA, IORDY(can be disabled)
DMA: sdma0 sdma1 sdma2 mdma0 mdma1 mdma2 udma0 udma1 *udma2
Cycle time: min=120ns recommended=120ns
PIO: pio0 pio1 pio2 pio3 pio4
Cycle time: no flow control=120ns IORDY flow control=120ns

- -

When I'm running these, I have a single-sided stamped DVD in drive.
These tend to make an awfull noise of hoovering when viewed (and
really need speed adjustment to 1-2x)

> > Booted into 2.4.28, speed-1.0 didn't do the trick there either. 'sense'
> > reported was 00.00.00 though.
>
> Any dmesg errors from 2.4.28? The sense reporting might be a bit broken
> there, but if you don't set cgc->quiet it should report the error in the
> kernel ring buffer at least.

No errors in dmesg. speedcontrol.c only reported that same error that
this current kernel did, but with sense 00.00.00.


--
psi -- http://iki.fi/psavo

2004-11-29 06:19:36

by Jens Axboe

[permalink] [raw]
Subject: Re: Is controlling DVD speeds via SET_STREAMING supported?

On Sun, Nov 28 2004, Pasi Savolainen wrote:
> On Sun, 28 Nov 2004 19:53:30 +0100, Jens Axboe <[email protected]> wrote:
> > > (under 2.6.10-rc2-mm1)
> > > I ran speed-1.0 program as root and also modified to open the device
> > > file as O_RDWR. This didn't help, it still reports same error.
> >
> > Ehm I don't see how that is possible, since that kernel definitely
> > contains SET_STREAMING as a write safe command. Are you 110% sure you
> > are running the kernel you think you are?
>
> I was talking about 'feature not suppoerted by device' -error.
> Got uptodate to 2.6.10-rc2-mm3, ran following:
> - -
> tienel:~# whoami
> root
> tienel:~# uname -a
> Linux tienel 2.6.10-rc2-mm3 #1 SMP Sun Nov 28 22:28:17 EET 2004 i686 GNU/Linux
> tienel:~# wget -q http://noto.de/speed/speedcontrol.c
> tienel:~# gcc -o speedcontrol speedcontrol.c
> tienel:~# ./speedcontrol -x 1 /dev/dvd
> Command failed: b6 00 00 00 00 00 00 00 00 00 1c 00 - sense: 05.20.00
> ERROR.
> tienel:~# tail /var/log/messages
> ...
> Nov 28 22:50:04 tienel kernel: hdb: packet command error: status=0x51
> { DriveReady SeekComplete Error }
> Nov 28 22:50:04 tienel kernel: hdb: packet command error: error=0x54
> Nov 28 22:50:04 tienel kernel: ide: failed opcode was 100

Makes more sense, then. It looks like you drive just isn't very happy
with the set streaming command. First I'd try to correct the end_lba of
the command, that might be it.

--
Jens Axboe