PDA

View Full Version : HOWTO: Enable DMA for a device



de4th
May 1st, 2005, 10:40 AM
If you have problem with cd/dvd's playback you have to enable DMA.
So open a console and type "sudo gedit /etc/hdparm.conf" (without "") and add these lines at the end of the file.


/dev/cdrom {
dma = on
}

Where "/dev/cdrom" you can add your device. Then restart your pc (don't know if there's a script that does the same... ) and play again the dvd!

Have fun ;)

PS1. Sorry for my bad english
PS2. If you see smth wrong reply

mrbass
May 2nd, 2005, 03:36 PM
This is part of the script I wrote for ubuntu addon zip



echo "CD-ROM current DMA mode"
sudo hdparm -i /dev/cdrom | grep "PIO modes"
sudo hdparm -i /dev/cdrom | grep "DMA modes"
echo "DVD-ROM current DMA mode"
sudo hdparm -i /dev/dvd | grep "PIO modes"
sudo hdparm -i /dev/dvd | grep "DMA modes"
echo "* signifies the current active mode"
read -p "Turn on DMA for CD-ROM and/or DVD-ROM? [Y/n/q]"
if [ "--$REPLY" == "--q" -o "--$REPLY" == "--Q" ]; then exit 0; fi
if [ "--$REPLY" == "--y" -o "--$REPLY" == "--Y" -o "--$REPLY" == "--" ]; then
sudo hdparm -d1 /dev/cdrom
sudo hdparm -d1 /dev/dvd
echo "CD-ROM current DMA mode"
sudo hdparm -i /dev/cdrom | grep "PIO modes"
sudo hdparm -i /dev/cdrom | grep "DMA modes"
echo "DVD-ROM current DMA mode"
sudo hdparm -i /dev/dvd | grep "PIO modes"
sudo hdparm -i /dev/dvd | grep "DMA modes"
else
echo "Skipped"
fi

arcilite
May 2nd, 2005, 04:17 PM
Can the dma be enabled for my usb hard drive? Transfer speed seems pretty damn slow for me currently.

de4th
May 2nd, 2005, 10:45 PM
Maybe u have usb 1.1! Connect it to usb 2.0 and will go faster
:cool:

orlandu
June 9th, 2005, 08:53 PM
The above advice didn't work for me to begin with - I got an error as follows:

setting using -dma to 1 (on)
HDIO set dma failed: operation not permitted
using dma = 0 (off)

This was eventually fixed (via some obscure googling) by removing all ide-* entries from modules (or modules.conf - I've done this in 2 different distributions) and rebooting. After that, hdparm could be used to set dma as normal.

I'm not sure exactly why this was needed, but at a guess it may have something to do with my only disk being SATA (my DVD drive is IDE primary master, /dev/hda).

Perhaps this will prove useful to others!

Firetech
June 9th, 2005, 09:10 PM
Be a bit careful with enabling DMA on older CD-players, they can (and probably will) break, or just not work right.
Enabling DMA on my CD recorder (I would guess it's about 5 years old), seem to have been the reason that my computer got totally stuck twice... Last time it got stuck in BIOS while "Auto-detecting Secondary Master" (Which is the CD). This, AND some strange messages in the syslog about "ATAPI timeout" and "disabling DMA", makes me think DMA was a bad idea...
Think twice about the age of your CD player (I guess DVD playes aren't affected by this...) before enabling this.
There is a reason why there is an option in the kernel for not enabling DMA on CD-ROMs, and why the stock ubuntu kernel has this enabled.

kleeman
June 9th, 2005, 09:36 PM
Don't forget this thread as well (Earned me brownie points :-P )

http://www.ubuntuforums.org/showthread.php?p=93238#post93238

bonifacio
June 9th, 2005, 10:11 PM
I have a problem (don't know if it's really a problem) that I posted on this thread that I need answer...
http://www.ubuntuforums.org/showthread.php?t=40582

Ok here's the text for those of you too lazy to click on the link: :p




After setting dma on in hdparm.conf

At startup after "Setting disc parameters..."

/dev/hdc: No such file or directory

Why?

Other than that the device seems to work as normal

Also I searched, scoured, irc'ed and googled but could not find any leads on how to enable DMA on a USB DVD burner.

darkaudit
June 9th, 2005, 10:41 PM
I used the command line version at the end of hdparm.conf and got the same error for my DVD burner. *BUT* DMA was enabled as intended. When I commented the line out, DMA was not turned on at boot.

So what is happening here?

bonifacio
June 9th, 2005, 10:48 PM
man says:

hdparm provides a command line interface to various hard disk ioctls supported by the stock Linux ATA/IDE device driver subsystem.

So I interpret it as only applicable to such device but NOT(?) USB device?

Silvio Moioli
June 10th, 2005, 09:09 AM
bonifacio: exactly.

royg1234
June 24th, 2005, 12:39 PM
I have a DVD+/-RW drive and a regular DVD drive. How do I tell what paths these are in? Through the file browser I see a:

cdrom [this has a shortcut icon next to it]
cdrw
dvd
dvd1
dvdrw


These all have shortcut icons next ot them. Is there something like "fdisk -l" that I can use?

skoal
June 24th, 2005, 03:01 PM
If you recompile your kernel, if you have these kernel options set:

CONFIG_GENERIC_ISA_DMA=y
CONFIG_ISA_DMA_API=y
CONFIG_BLK_DEV_IDEDMA_PCI=y
# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
CONFIG_IDEDMA_PCI_AUTO=y
# CONFIG_IDEDMA_ONLYDISK is not set
CONFIG_BLK_DEV_IDEDMA=y
# CONFIG_IDEDMA_IVB is not set
CONFIG_IDEDMA_AUTO=y

It will enable DMA on all your drives without the use of hdparm. Of course, a lot of distros (like Ubuntu) don't enable this kernel option for a good reason. Know your hardware...

* NOTE: I believe it's just the last 2 options which need to be set for this to occur.

\\//_

pacz
July 15th, 2005, 03:45 PM
I tried adding the correct module for my board (piix) at the top of /etc/modules, but it caused my system to hang. After scouring google hits and bugzilla, I found a solution. Apparently you have to add the module to the top of /etc/modules, but you also have to add it to /etc/hotplug/blacklist, so that it doesn't start too soon.

I had tried doing all sorts of things with hdparm, but I had to do the above before hdparm would work.

However, it took a very long time for me to find that solution, so I'll post it big and bold here in case anybody else was having as much trouble as I was:

last resort solution:
add the module (piix, via82cxxx, AMD74xxx, etc) to the top of /etc/modules, but you also have to add it to /etc/hotplug/blacklist

No6
July 15th, 2005, 04:06 PM
I've had this problem also. The quickest and easiest way I found to fix it was to rename the script in the /etc/rcS.d dir so it didn't run too soon. I renamed it S71hdparm. This ran the script after the CDs are available.

Simple yet effective.

HTH

greenwom
July 15th, 2005, 04:44 PM
I've followed threads and enabled DMA for my dvd-drive, It plays the DVDs now but the video is choppy and breaks. I haven't even tried to burn anything on that drive yet.
Do I have to specify a speed setting for the drive somewhere?
:roll:

SKLP
July 15th, 2005, 04:48 PM
thx

Stabicron
July 17th, 2005, 09:58 PM
I have an interesting problem. I have a Plextor 708A DVD+/- RW/CD-RW combo drive. Doing the hdparm command *with cdrom* works. But adding the /dev/cdrom dma=on stuff in hparm.conf does not *it keeps saying device not found at boot*. I have also tried substituting cdrom with hdc, same thing happens. This is kind of annoying especially when i wish to burn a cd in linux, if dma is not enabled it burns like a snail. Anyone have an idea of what I should do? Have thought about wether its possible to make a script that runs on start with the hparm command, but since I have no idea how to do that *is still learning* I guess that will have to wait.

TheRockit
July 18th, 2005, 12:05 AM
I am having a problem playing DVD's on a Panasonic DVDrom. The disc autoloads, puts an icon with the correct title name on my desktop, the player opens and then just sits there unresponsive. Eventually I will close the player and have to acknowledge and error saying it needs to be forced.

I added the suggested line to the end of my hdparm.conf (which by the way has a lot of text in it, I am assuming any line preceeded by a # is remarked out?) and restarted the unit but there is not change in my problem. Any advice on the steps to take? I am totally new at command line editing for devices and such- since about 1997 I have been stuck in the 'other' OS and would consider myself a newbie all over again concerning manual configurations!

Thanks :roll:

Mauleye
July 18th, 2005, 10:59 AM
I did it ... had some problems already discussed here (had to add amd46-stuff to modules). But now I have another interesting problem: My DVD-Burner (Plextor PX716) just burns trash ... I don't know if this is because of the dma-activation but it's definitly possible.

Anyone have the same probs?

ounn
July 18th, 2005, 08:11 PM
Hi there.

I also had many problems with dma. I use to saw dvds like slow motion.
After reading many howtos i stay with the idea that i had to load some modules at startup. I have tried many options sugested somewhere here in the forum and finaly managed a way to turn on dma \\:D/

What i did:

load this and just this modules (replace yours modules at /etc/modules with this ones):


amd74xx
lp
mousedev
psmouse

amd74xx is beacause i have a amd, if you have intel you probably need another module that i dont know.

than add this line at the bottom of /etc/hdparm.conf


/dev/dvd {
dma = on
}


and its all. Just reboot and you can see and burn yours dvds.

About the error on boot about "/dev/dvd not found" i also have that "warning" but just ignore him.


ounn

frodon
July 31st, 2005, 10:31 PM
What i did:

load this and just this modules (replace yours modules at /etc/modules with this ones):


amd74xx
lp
mousedev
psmouse

Wow it completly solve my problem :-P
A big big big thank you !!!!!! \\:D/

mstlyevil
August 27th, 2005, 06:31 AM
load this and just this modules (replace yours modules at /etc/modules with this ones):


amd74xx
lp
mousedev
psmouse

amd74xx is beacause i have a amd, if you have intel you probably need another module that i dont know


ounn

You are my new God! I have been puzzled by this problem for a week. I just added that line to my modules file and bang! I could enable my dma on both my cd rw and dvd rom. I worship the ground you walk on. Thanx. \\:D/

arnieboy
October 21st, 2005, 09:04 PM
Hi there.

I also had many problems with dma. I use to saw dvds like slow motion.
After reading many howtos i stay with the idea that i had to load some modules at startup. I have tried many options sugested somewhere here in the forum and finaly managed a way to turn on dma \\:D/

What i did:

load this and just this modules (replace yours modules at /etc/modules with this ones):


amd74xx
lp
mousedev
psmouse

amd74xx is beacause i have a amd, if you have intel you probably need another module that i dont know.

than add this line at the bottom of /etc/hdparm.conf


/dev/dvd {
dma = on
}


and its all. Just reboot and you can see and burn yours dvds.

About the error on boot about "/dev/dvd not found" i also have that "warning" but just ignore him.


ounn
is your system an AMD64? or a 32 bit AMD system?