Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Multimedia
  • Search

Problem with setting DVD-ROM drive speed

Help with creation, editing, or playback of sounds, images, or video. Amarok, audacious, mplayer, grip, cdparanoia and anything else that makes a sound or plays a video.
Post Reply
Advanced search
16 posts • Page 1 of 1
Author
Message
risa2000
n00b
n00b
Posts: 35
Joined: Sun Oct 17, 2004 3:34 pm

Problem with setting DVD-ROM drive speed

  • Quote

Post by risa2000 » Thu Jan 06, 2005 11:27 am

Hello,

I cannot set DVD-ROM drive speed to anything other than default. I have tried

Code: Select all

hdparm -E <number> /dev/hdc
eject -x <number> /dev/hdc
where <number> was 1, 2, 4, 8 and /dev/hdc is my DVD-ROM drive.

I am using plain vanilla kernel from kernel.org (2.6.10 right now, had 2.6.9 too). Hardware is IBM ThinkPad R40 2722-GAU, (Pentium-M 1.5) and the drive reports as

Code: Select all

root@gtx-tp root  # hdparm -I /dev/hdc

/dev/hdc:

ATAPI CD-ROM, with removable media
        Model Number:       HL-DT-STCD-RW/DVD DRIVE GCC-4240N
        Serial Number:
        Firmware Revision:  0211
Standards:
        Likely used CD-ROM ATAPI-1
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
Does anybody know, what might be a problem? I would really like to play my DVDs at lowest speed, since the drive is otherwise pretty noisy.
Top
finn
n00b
n00b
Posts: 54
Joined: Sun May 30, 2004 8:03 pm
Location: Plzen, Czech Republic

  • Quote

Post by finn » Thu Jan 06, 2005 9:41 pm

If an error occures, eject prints an error message, probably something like

Code: Select all

eject: CD-ROM select speed command failed: ...
Does it?
Top
risa2000
n00b
n00b
Posts: 35
Joined: Sun Oct 17, 2004 3:34 pm

  • Quote

Post by risa2000 » Sat Jan 08, 2005 11:36 am

finn wrote:If an error occures, eject prints an error message, probably something like

Code: Select all

eject: CD-ROM select speed command failed: ...
Does it?
No, it looks normal (no error so far, in console or log), just the drive ignores the setting.
Top
finn
n00b
n00b
Posts: 54
Joined: Sun May 30, 2004 8:03 pm
Location: Plzen, Czech Republic

  • Quote

Post by finn » Sat Jan 08, 2005 1:31 pm

According to ATAPI specification, this command (Set CD Speed) is not mandatory, so there is a possibility that your drive doesn't support this, but... If there is no error in logs, it seems that the drive did change the speed.

Changing the speed is done via simple ioctl, and there are not many things which could fail...
Top
risa2000
n00b
n00b
Posts: 35
Joined: Sun Oct 17, 2004 3:34 pm

  • Quote

Post by risa2000 » Sat Jan 08, 2005 2:13 pm

Well, the drive definitely support something like this, because in Windows, when using WinDVD player the drive runs pretty silent (probably at 1x or 2x speed). PowerDVD on the other hand, does not utilize this feature and as such is almost unusable (due to noise).

I wonder, whether the problem might stem from the fact that it is DVD what is played and it is not affected by setting _CD_ speed?
Top
finn
n00b
n00b
Posts: 54
Joined: Sun May 30, 2004 8:03 pm
Location: Plzen, Czech Republic

  • Quote

Post by finn » Sat Jan 08, 2005 3:48 pm

I wonder, whether the problem might stem from the fact that it is DVD what is played and it is not affected by setting _CD_ speed?
No, I don't think so.

Well, I looked in the kernel sources and I've found something that could explain your problem. The speed is counted this way:

Code: Select all

if (speed == 0)
  speed = 0xffff; /* set to max */
else
  speed *= 177;   /* Nx to kbytes/s */
Now, ATAPI specification says, that:
If the speed selected is less than 1x, then the drive shall reject the command, and not change the speed.
But the speed 1x in kB/s is different for DVD and CD, so the problem may be, that the drive recieves request for changing speed to 177 kB/s but it can't do it because the speed (177 kB/s) is lower than nominal lowest speed for DVD's (more than 1 MB/s). That could be the reason.
Top
risa2000
n00b
n00b
Posts: 35
Joined: Sun Oct 17, 2004 3:34 pm

  • Quote

Post by risa2000 » Sat Jan 08, 2005 5:53 pm

I have tried several different values (1, 2, 8, 10, 16) with both hdparm and eject without success. I also tried changing settings using

Code: Select all

echo current_speed:<number> > /proc/ide/hdc/settings
or

Code: Select all

echo init_speed:<number> > /proc/ide/hdc/settings
with numbers 1, 10, 16, 24, 40. Although the value changed (and sometimes also dma mode changed) it did not affect the speed of the drive, only emits following line into syslog:

Code: Select all

Jan  8 18:29:56 gtx-tp Warning: /proc/ide/hd?/settings interface is obsolete, and will be removed soon!
So I guess there is no point in messing with this either.
BTW my settings are:

Code: Select all

root@gtx-tp root # cat /proc/ide/hdc/settings
name                    value           min             max             mode
----                    -----           ---             ---             ----
current_speed           66              0               70              rw
dsc_overlap             0               0               1               rw
init_speed              66              0               70              rw
io_32bit                1               0               3               rw
keepsettings            0               0               1               rw
nice1                   1               0               1               rw
number                  2               0               3               rw
pio_mode                write-only      0               255             w
unmaskirq               1               0               1               rw
using_dma               1               0               1               rw
I tweak few values myself in hdparm config (/etc/conf.d/hdparm) this way:

Code: Select all

root@gtx-tp root # cat /etc/conf.d/hdparm
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-apps/hdparm/files/hdparm-conf.d.3,v 1.2 2004/09/06 02:17:08 swegener Exp $

# You can either set hdparm arguments for each drive using hdX_args,
# discX_args, cdromX_args and genericX_args, e.g.
#
# hda_args="-d1 -X66"
# disc1_args="-d1"
# cdrom0_args="-d1"

# or, you can set hdparm options for ALL drives using all_args, e.g.
#
all_args="-d1"
cdrom0_args="-d1 -c1 -u1"
finn I appreciate your help so far - do you have yet any idea where to look?
Top
finn
n00b
n00b
Posts: 54
Joined: Sun May 30, 2004 8:03 pm
Location: Plzen, Czech Republic

  • Quote

Post by finn » Sat Jan 08, 2005 6:57 pm

Yes, I have two ideas: firstly you can turn on debug mode (if the drive rejects the command I would expect some error message in kernel log):

Code: Select all

echo 1 > /proc/sys/dev/cdrom/debug
and secondly you can add some debug — printk — lines to the linux kernel (-:
Top
risa2000
n00b
n00b
Posts: 35
Joined: Sun Oct 17, 2004 3:34 pm

  • Quote

Post by risa2000 » Sat Jan 08, 2005 10:00 pm

After setting debug mode on cdrom when issuing:

Code: Select all

root@gtx-tp root # hdparm -E 2 /dev/hdc

/dev/hdc:
setting cdrom speed to 2
I got following debug output in syslog:

Code: Select all

Jan  8 22:52:15 gtx-tp cdrom: entering cdrom_open
Jan  8 22:52:15 gtx-tp cdrom: Use count for "/dev/hdc" now 1
Jan  8 22:52:15 gtx-tp cdrom: entering CDROM_SELECT_SPEED
Jan  8 22:52:15 gtx-tp cdrom: entering cdrom_release
Jan  8 22:52:15 gtx-tp cdrom: Use count for "/dev/hdc" now zero
Jan  8 22:52:15 gtx-tp cdrom: hdc: No DVD+RW
Jan  8 22:52:15 gtx-tp cdrom: Unlocking door!
This seems OK since normal DVD playback looks like this:

Code: Select all

Jan  8 22:55:27 gtx-tp cdrom: entering cdrom_open
Jan  8 22:55:27 gtx-tp cdrom: entering open_for_data
Jan  8 22:55:27 gtx-tp cdrom: drive_status=4
Jan  8 22:55:27 gtx-tp cdrom: entering cdrom_count_tracks
Jan  8 22:55:27 gtx-tp cdrom: track 1: format=2, ctrl=4
Jan  8 22:55:27 gtx-tp cdrom: disc has 1 tracks: 0=audio 1=data 0=Cd-I 0=XA
Jan  8 22:55:27 gtx-tp cdrom: all seems well, opening the device.
Jan  8 22:55:27 gtx-tp cdrom: opening the device gave me 0.
Jan  8 22:55:27 gtx-tp cdrom: door locked.
Jan  8 22:55:27 gtx-tp cdrom: device opened successfully.
Jan  8 22:55:27 gtx-tp cdrom: Use count for "/dev/hdc" now 1
Jan  8 22:55:27 gtx-tp cdrom: entering DVD_READ_STRUCT
Jan  8 22:55:27 gtx-tp cdrom: entering DVD_AUTH
Jan  8 22:55:27 gtx-tp cdrom: entering DVD_LU_SEND_AGID
Jan  8 22:55:27 gtx-tp cdrom: entering DVD_AUTH
Jan  8 22:55:27 gtx-tp cdrom: entering DVD_HOST_SEND_CHALLENGE
Jan  8 22:55:27 gtx-tp cdrom: entering DVD_AUTH
Jan  8 22:55:27 gtx-tp cdrom: entering DVD_LU_SEND_KEY1
Jan  8 22:55:27 gtx-tp cdrom: entering DVD_AUTH
Jan  8 22:55:27 gtx-tp cdrom: entering DVD_LU_SEND_CHALLENGE
Jan  8 22:55:27 gtx-tp cdrom: entering DVD_AUTH
Jan  8 22:55:27 gtx-tp cdrom: entering DVD_HOST_SEND_KEY2
Jan  8 22:55:27 gtx-tp cdrom: entering DVD_READ_STRUCT
Jan  8 22:55:27 gtx-tp cdrom: entering DVD_AUTH
Jan  8 22:55:27 gtx-tp cdrom: entering DVD_LU_SEND_ASF
Jan  8 22:55:33 gtx-tp cdrom: entering cdrom_release
Jan  8 22:55:33 gtx-tp cdrom: Use count for "/dev/hdc" now zero
Jan  8 22:55:33 gtx-tp cdrom: hdc: No DVD+RW
Jan  8 22:55:33 gtx-tp cdrom: Unlocking door!
I tried to look at the code and found this (cdrom.c)

Code: Select all

	case CDROM_SELECT_SPEED: {
		cdinfo(CD_DO_IOCTL, "entering CDROM_SELECT_SPEED\n"); 
		if (!CDROM_CAN(CDC_SELECT_SPEED))
			return -ENOSYS;
		return cdo->select_speed(cdi, arg);
		}
but I do not know, how to find implementation of select_speed, or even if this function is at all called. So adding printk is yet unclear :?.
Top
finn
n00b
n00b
Posts: 54
Joined: Sun May 30, 2004 8:03 pm
Location: Plzen, Czech Republic

  • Quote

Post by finn » Sat Jan 08, 2005 11:45 pm

Changing the CD-ROM speed is implemented in function cdrom_select_speed() in linux/drivers/ide/ide-cd.c. So instead of

Code: Select all

return cdrom_queue_packet_command(drive, &req);
you can write something like

Code: Select all

static int cdrom_select_speed(ide_drive_t *drive, int speed,
                              struct request_sense *sense)
{
int retval;
...
retval = cdrom_queue_packet_command(drive, &req);
printk(KERN_ALERT "ide-cd: Set CD speed packet command return value: %d\n", retval); /* KERN_ALERT = high priority */
return retval;
}
Now, after you recompile the kernel, you will see if the packet command failed or not (the command failed if retval != 0).

Remember: I didn't test it, so if you don't know what exactly this code does, don't try it, I won't be responsible for anything :)
Top
risa2000
n00b
n00b
Posts: 35
Joined: Sun Oct 17, 2004 3:34 pm

  • Quote

Post by risa2000 » Sun Jan 09, 2005 9:51 am

I did the mod you suggested and got:

Code: Select all

Jan  9 10:47:09 gtx-tp cdrom: entering CDROM_SELECT_SPEED
Jan  9 10:47:09 gtx-tp ide-cd: Set CD speed packet command return value: 0
Jan  9 10:47:09 gtx-tp cdrom: entering cdrom_release
I assume it means OK.
Top
risa2000
n00b
n00b
Posts: 35
Joined: Sun Oct 17, 2004 3:34 pm

  • Quote

Post by risa2000 » Sun Jan 09, 2005 11:39 am

I would like to add that I have tested hdparm and eject speed setting options with regular data CD (something I should have probably done at the begining) and it behaves as accepted until the CD is unmounted. So

Code: Select all

mount /dev/cdrom /mnt/cdrom
hdparm -E 1 /dev/hdc
<some copy from CD to local FS>
really copy at low speed. After unmount/eject the speed is back at max.

The same however does not work for DVD. It seems that the driver either does not set DVD speed correctly (if there is such thing) or DVD commands to the drive ignore CD speed settings.

I am trying to find out some ATAPI spec for CD and DVD to check if there is any difference in between, but have not found anything yet.
Top
finn
n00b
n00b
Posts: 54
Joined: Sun May 30, 2004 8:03 pm
Location: Plzen, Czech Republic

  • Quote

Post by finn » Sun Jan 09, 2005 1:08 pm

Yes, the same thing does my DVD drive. With CD the drive changes the speed correctly but with DVD it seems not to change anything. Also other people reported the problem here (it's Czech so you will have to trust me (–:). Resetting the speed after changing media is normal behavior.

There is one strange thing: ATAPI specification says, that the drive shall reject the command if selected speed is less than 1× but if the drive rejects this command, then return value from cdrom_select_speed shouldn't be 0. I would also expect some error message in kernel log. So everything looks like the drive accepts the command but doesn't change the speed. Strange. Maybe we should start a new thread in Kernel & Hardware forum (–:

P. S. I've found an interesting post in linux kernel mail archive.
Top
risa2000
n00b
n00b
Posts: 35
Joined: Sun Oct 17, 2004 3:34 pm

  • Quote

Post by risa2000 » Sun Jan 09, 2005 4:08 pm

It seems to me that either the implementation for DVD control is missing in kernel, or the user space tools simply do not use it. Anyway, I think this is kernel issue, also I do not understand why SET_STREAMING is recommended for DVD drives (instead of CDROM_SELECT_SPEED) and also, why no one complains (well, except me :) ), since this must definitely bother more people with fast drives. I will need to do a bit more research.

P.S. Czech is fine for me ;-).

<EDIT>: Put SET_STREAMING into Google and you will see we are not the only ones bothered :idea:.
Top
tiennou
n00b
n00b
Posts: 2
Joined: Sun Sep 26, 2004 9:37 am

  • Quote

Post by tiennou » Wed Feb 23, 2005 7:25 pm

You could try to set 'speed=2' in the DVD's line of in fstab...
Top
HS
n00b
n00b
User avatar
Posts: 10
Joined: Sun Apr 10, 2005 7:49 pm

  • Quote

Post by HS » Sat Oct 21, 2006 2:02 pm

This speedcontrol (http://safari.iki.fi/speedcontrol.c) tool works.
Top
Post Reply

16 posts • Page 1 of 1

Return to “Multimedia”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic