linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: Re: Is controlling DVD speeds via SET_STREAMING supported?
@ 2004-11-26 19:59 Thomas Fritzsche
  2004-11-27  9:54 ` Thomas Fritzsche
  0 siblings, 1 reply; 18+ messages in thread
From: Thomas Fritzsche @ 2004-11-26 19:59 UTC (permalink / raw)
  To: linux-kernel

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
>
>





^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Re: Is controlling DVD speeds via SET_STREAMING supported?
  2004-11-26 19:59 Re: Is controlling DVD speeds via SET_STREAMING supported? Thomas Fritzsche
@ 2004-11-27  9:54 ` Thomas Fritzsche
  2004-11-27 20:57   ` Pasi Savolainen
  0 siblings, 1 reply; 18+ messages in thread
From: Thomas Fritzsche @ 2004-11-27  9:54 UTC (permalink / raw)
  To: linux-kernel

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 <tf@noto.de>
 *
 *   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
>>
>>
>
>
>
>



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Is controlling DVD speeds via SET_STREAMING supported?
  2004-11-27  9:54 ` Thomas Fritzsche
@ 2004-11-27 20:57   ` Pasi Savolainen
  2004-11-27 21:02     ` Jan Engelhardt
  2004-11-27 23:17     ` Thomas Fritzsche
  0 siblings, 2 replies; 18+ messages in thread
From: Pasi Savolainen @ 2004-11-27 20:57 UTC (permalink / raw)
  To: linux-kernel

* Thomas Fritzsche <tf@noto.de>:
> 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>


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Is controlling DVD speeds via SET_STREAMING supported?
  2004-11-27 20:57   ` Pasi Savolainen
@ 2004-11-27 21:02     ` Jan Engelhardt
  2004-11-27 23:17     ` Thomas Fritzsche
  1 sibling, 0 replies; 18+ messages in thread
From: Jan Engelhardt @ 2004-11-27 21:02 UTC (permalink / raw)
  To: Pasi Savolainen; +Cc: linux-kernel


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, www.gwdg.de

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Is controlling DVD speeds via SET_STREAMING supported?
  2004-11-27 20:57   ` Pasi Savolainen
  2004-11-27 21:02     ` Jan Engelhardt
@ 2004-11-27 23:17     ` Thomas Fritzsche
  2004-11-28 11:18       ` Pasi Savolainen
  1 sibling, 1 reply; 18+ messages in thread
From: Thomas Fritzsche @ 2004-11-27 23:17 UTC (permalink / raw)
  To: Pasi Savolainen; +Cc: linux-kernel

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 <tf@noto.de>:
>> 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 majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>
>



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Is controlling DVD speeds via SET_STREAMING supported?
  2004-11-27 23:17     ` Thomas Fritzsche
@ 2004-11-28 11:18       ` Pasi Savolainen
  2004-11-28 14:25         ` Thomas Fritzsche
  0 siblings, 1 reply; 18+ messages in thread
From: Pasi Savolainen @ 2004-11-28 11:18 UTC (permalink / raw)
  To: linux-kernel

* Thomas Fritzsche <tf@noto.de>:
> 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>


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Is controlling DVD speeds via SET_STREAMING supported?
  2004-11-28 11:18       ` Pasi Savolainen
@ 2004-11-28 14:25         ` Thomas Fritzsche
  2004-11-28 16:52           ` Jens Axboe
  0 siblings, 1 reply; 18+ messages in thread
From: Thomas Fritzsche @ 2004-11-28 14:25 UTC (permalink / raw)
  To: Pasi Savolainen; +Cc: linux-kernel, axboe

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


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Is controlling DVD speeds via SET_STREAMING supported?
  2004-11-28 14:25         ` Thomas Fritzsche
@ 2004-11-28 16:52           ` Jens Axboe
  2004-11-28 17:49             ` Pasi Savolainen
  0 siblings, 1 reply; 18+ messages in thread
From: Jens Axboe @ 2004-11-28 16:52 UTC (permalink / raw)
  To: Thomas Fritzsche; +Cc: Pasi Savolainen, linux-kernel

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


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Is controlling DVD speeds via SET_STREAMING supported?
  2004-11-28 17:49             ` Pasi Savolainen
@ 2004-11-28 16:53               ` Thomas Fritzsche
  2004-11-28 18:53               ` Jens Axboe
  1 sibling, 0 replies; 18+ messages in thread
From: Thomas Fritzsche @ 2004-11-28 16:53 UTC (permalink / raw)
  To: psavo; +Cc: linux-kernel, axboe

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 <axboe@suse.de>:
>>> > 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>
>



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Is controlling DVD speeds via SET_STREAMING supported?
  2004-11-28 16:52           ` Jens Axboe
@ 2004-11-28 17:49             ` Pasi Savolainen
  2004-11-28 16:53               ` Thomas Fritzsche
  2004-11-28 18:53               ` Jens Axboe
  0 siblings, 2 replies; 18+ messages in thread
From: Pasi Savolainen @ 2004-11-28 17:49 UTC (permalink / raw)
  To: linux-kernel

* Jens Axboe <axboe@suse.de>:
>> > 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>


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Is controlling DVD speeds via SET_STREAMING supported?
  2004-11-28 17:49             ` Pasi Savolainen
  2004-11-28 16:53               ` Thomas Fritzsche
@ 2004-11-28 18:53               ` Jens Axboe
  2004-11-28 21:01                 ` Pasi Savolainen
  1 sibling, 1 reply; 18+ messages in thread
From: Jens Axboe @ 2004-11-28 18:53 UTC (permalink / raw)
  To: Pasi Savolainen; +Cc: linux-kernel


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

On Sun, Nov 28 2004, Pasi Savolainen wrote:
> * Jens Axboe <axboe@suse.de>:
> >> > 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


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Is controlling DVD speeds via SET_STREAMING supported?
  2004-11-28 18:53               ` Jens Axboe
@ 2004-11-28 21:01                 ` Pasi Savolainen
  2004-11-29  6:19                   ` Jens Axboe
  0 siblings, 1 reply; 18+ messages in thread
From: Pasi Savolainen @ 2004-11-28 21:01 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-kernel, Thomas Fritzsche

On Sun, 28 Nov 2004 19:53:30 +0100, Jens Axboe <axboe@suse.de> 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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Is controlling DVD speeds via SET_STREAMING supported?
  2004-11-28 21:01                 ` Pasi Savolainen
@ 2004-11-29  6:19                   ` Jens Axboe
  0 siblings, 0 replies; 18+ messages in thread
From: Jens Axboe @ 2004-11-29  6:19 UTC (permalink / raw)
  To: pasi.savolainen; +Cc: linux-kernel, Thomas Fritzsche

On Sun, Nov 28 2004, Pasi Savolainen wrote:
> On Sun, 28 Nov 2004 19:53:30 +0100, Jens Axboe <axboe@suse.de> 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


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Is controlling DVD speeds via SET_STREAMING supported?
  2004-11-20 20:19 ` Jens Axboe
@ 2004-11-20 23:50   ` David Härdeman
  0 siblings, 0 replies; 18+ messages in thread
From: David Härdeman @ 2004-11-20 23:50 UTC (permalink / raw)
  To: linux-kernel

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Is controlling DVD speeds via SET_STREAMING supported?
  2004-11-20 16:17 David Härdeman
  2004-11-20 16:30 ` Jan Engelhardt
@ 2004-11-20 20:19 ` Jens Axboe
  2004-11-20 23:50   ` David Härdeman
  1 sibling, 1 reply; 18+ messages in thread
From: Jens Axboe @ 2004-11-20 20:19 UTC (permalink / raw)
  To: David Härdeman; +Cc: linux-kernel

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


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Is controlling DVD speeds via SET_STREAMING supported?
  2004-11-20 16:30 ` Jan Engelhardt
@ 2004-11-20 16:45   ` David Härdeman
  0 siblings, 0 replies; 18+ messages in thread
From: David Härdeman @ 2004-11-20 16:45 UTC (permalink / raw)
  To: linux-kernel

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


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Is controlling DVD speeds via SET_STREAMING supported?
  2004-11-20 16:17 David Härdeman
@ 2004-11-20 16:30 ` Jan Engelhardt
  2004-11-20 16:45   ` David Härdeman
  2004-11-20 20:19 ` Jens Axboe
  1 sibling, 1 reply; 18+ messages in thread
From: Jan Engelhardt @ 2004-11-20 16:30 UTC (permalink / raw)
  To: David Härdeman; +Cc: linux-kernel

>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, www.gwdg.de

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Is controlling DVD speeds via SET_STREAMING supported?
@ 2004-11-20 16:17 David Härdeman
  2004-11-20 16:30 ` Jan Engelhardt
  2004-11-20 20:19 ` Jens Axboe
  0 siblings, 2 replies; 18+ messages in thread
From: David Härdeman @ 2004-11-20 16:17 UTC (permalink / raw)
  To: linux-kernel

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...

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2004-11-29  6:19 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-26 19:59 Re: Is controlling DVD speeds via SET_STREAMING supported? Thomas Fritzsche
2004-11-27  9:54 ` Thomas Fritzsche
2004-11-27 20:57   ` Pasi Savolainen
2004-11-27 21:02     ` Jan Engelhardt
2004-11-27 23:17     ` Thomas Fritzsche
2004-11-28 11:18       ` Pasi Savolainen
2004-11-28 14:25         ` Thomas Fritzsche
2004-11-28 16:52           ` Jens Axboe
2004-11-28 17:49             ` Pasi Savolainen
2004-11-28 16:53               ` Thomas Fritzsche
2004-11-28 18:53               ` Jens Axboe
2004-11-28 21:01                 ` Pasi Savolainen
2004-11-29  6:19                   ` Jens Axboe
  -- strict thread matches above, loose matches on Subject: below --
2004-11-20 16:17 David Härdeman
2004-11-20 16:30 ` Jan Engelhardt
2004-11-20 16:45   ` David Härdeman
2004-11-20 20:19 ` Jens Axboe
2004-11-20 23:50   ` David Härdeman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).