Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
CDROM (not) hot swaping [UPDATE NEW INFO]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
beatryder
Veteran
Veteran


Joined: 08 Apr 2005
Posts: 1138

PostPosted: Fri Jun 10, 2005 2:49 am    Post subject: CDROM (not) hot swaping [UPDATE NEW INFO] Reply with quote

Has any one out there had trouble with hot swaping?

If I start my laptop with my modular bay battery installed, and try to get my cdrom working after that (via swaping the battery for the cdrom) it wont work.

Is there any way of forcing the kernel to reinitalize the IDE drivers? Or somthing to that nature?

Ok, so after following some suggestions I found on the forums I have managed to DMA working properly for this drive.

I have since made another observation

When I boot *without* the cd/dvdrw installed I get the following in my dmesg
Code:

 ata2: diasbling port


But this does not show up in dmesg when the drive is plugged in
Code:

$ dmesg | grep ata
[   26.241603] libata version 1.11 loaded.
[   26.241672] ata_piix version 1.03
[   26.241712] ata1: SATA max UDMA/133 cmd 0x1F0 ctl 0x3F6 bmdma 0xBFA0 irq 14
[   26.243234] ata1: dev 0 cfg 49:0f00 82:746b 83:7fe8 84:4023 85:f46b 86:3c48 87:4023 88:203f
[   26.243239] ata1: dev 0 ATA-6, max UDMA/100, 117210240 sectors: LBA48
[   26.243241] ata1(0): applying bridge limits
[   26.243316] ata1: dev 0 configured for UDMA/100
[   26.243318] scsi0 : ata_piix
[   26.244071] ata2: SATA max UDMA/133 cmd 0x170 ctl 0x376 bmdma 0xBFA8 irq 15
[   26.245785] ata2: dev 0 cfg 49:0b00 82:0000 83:0000 84:0000 85:0000 86:0000 87:0000 88:0407
[   26.245788] ata2: dev 0 ATAPI, max UDMA/33
[   26.245868] ata2: dev 0 configured for UDMA/33
[   26.245870] scsi1 : ata_piix


Is there a way to make ata2 start listening on that port after boot? Or set it up so that it allocates the resources even if the device is not connected?
Compiling as a module is not an option, as the computer will not boot unless its static.
_________________
Dont make it idiot proof, make it work.
Neucode.org
<suppressed key>


Last edited by beatryder on Mon Jul 04, 2005 8:30 pm; edited 2 times in total
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54216
Location: 56N 3W

PostPosted: Fri Jun 10, 2005 3:27 pm    Post subject: Reply with quote

beatryder,

IDE is not hot swappable by design.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
beatryder
Veteran
Veteran


Joined: 08 Apr 2005
Posts: 1138

PostPosted: Fri Jun 10, 2005 3:32 pm    Post subject: Reply with quote

Then can someone explain to me how Laptop hot swap drives work???

I apologize for the harsh tone, but this is frustrating.

This works perfectly under windows. Which means that there is a way to do it, I just need to figure out how.
_________________
Dont make it idiot proof, make it work.
Neucode.org
<suppressed key>
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54216
Location: 56N 3W

PostPosted: Fri Jun 10, 2005 3:38 pm    Post subject: Reply with quote

beatryder,

Is your laptop CDROM IDE or something else ?
SCSI, SATA, USB, and Firewire are all hot swappable
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
beatryder
Veteran
Veteran


Joined: 08 Apr 2005
Posts: 1138

PostPosted: Fri Jun 10, 2005 3:49 pm    Post subject: Reply with quote

Its an atapi DVD/RW, if I remove IDE support from my kernel. it will not work no matter what I try.

-Thx



[Edit] I was wrong, it just took some kernel hacking.
_________________
Dont make it idiot proof, make it work.
Neucode.org
<suppressed key>


Last edited by beatryder on Mon Jul 04, 2005 8:37 pm; edited 1 time in total
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54216
Location: 56N 3W

PostPosted: Fri Jun 10, 2005 4:12 pm    Post subject: Reply with quote

beatryder,

It must be close to IDE but standard IDE is not hot swappable.
Do you need the IDE driver for your main HDD?

If not, making IDE support as a module and loading it after the CD/DVD is installed may be a work around.
/usr/src/linux/Documentation/kernel-parameters.txt and the IDE documentaion may be worth a read too.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
beatryder
Veteran
Veteran


Joined: 08 Apr 2005
Posts: 1138

PostPosted: Fri Jun 10, 2005 5:03 pm    Post subject: Reply with quote

My HD works on the SATA driver, so its uneffected by IDE driver changes

I have tried playing with modulizing the ide drivers, albeit I have not spend more than 15 mins on it.

I will give that some further looking into and post a fix if I can find one.
_________________
Dont make it idiot proof, make it work.
Neucode.org
<suppressed key>
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54216
Location: 56N 3W

PostPosted: Fri Jun 10, 2005 5:13 pm    Post subject: Reply with quote

beatryder,

Hmm, I'm surprised that a laptop has both SATA and IDE. It tight for space.
Some chip sets come with IDE built in, so there may be no savings to be had.

If it works by modprobing the IDE module, udev and hotplug can probably automate it.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
beatryder
Veteran
Veteran


Joined: 08 Apr 2005
Posts: 1138

PostPosted: Fri Jun 10, 2005 5:25 pm    Post subject: Reply with quote

FYI, SATA is backwards compatable to IDE,

My HD is an IDE HD but its using a SATA controler, also to my knowledge there are no SATA CD/DVD ROMs out there yet.
_________________
Dont make it idiot proof, make it work.
Neucode.org
<suppressed key>
Back to top
View user's profile Send private message
fredgt
Apprentice
Apprentice


Joined: 06 Dec 2004
Posts: 168
Location: Belgium

PostPosted: Fri Jun 10, 2005 6:30 pm    Post subject: Reply with quote

There are already some dvd/cdrom drives on sata but as most motherboards still have a ide on board there is not much use for it especialy with some operating systems not supporting it without 3rd party drivers. So installing them can become a lot more difficult with a sata cdrom drive.

Normally ide isn't hotswappable but some laptops do have a hotswappable support for the cd-rom drive. I don't know how but it is possible.
I wouldn't advise using it. When i unplug my cd-rom while running it keeps giving errors in dmesg just untill i plug it in again.

Code:

hdc: status error: status=0x00 { }
ide: failed opcode was: unknown
hdc: status error: status=0xff { Busy }
ide: failed opcode was: unknown
hdc: drive not ready for command
hdc: ATAPI reset complete


When you boot with the cdrom in it it could work when you swap to battery and then back to the cdrom but i wouldn't advise u to use it much as it keeps generating error and could generate some big error logs. So shutting down before swappig is probably the best option.
Back to top
View user's profile Send private message
beatryder
Veteran
Veteran


Joined: 08 Apr 2005
Posts: 1138

PostPosted: Fri Jun 10, 2005 8:03 pm    Post subject: Reply with quote

NeddySeagoon wrote:
beatryder,

Hmm, I'm surprised that a laptop has both SATA and IDE. It tight for space.
Some chip sets come with IDE built in, so there may be no savings to be had.

If it works by modprobing the IDE module, udev and hotplug can probably automate it.


just tried that, no dice.
_________________
Dont make it idiot proof, make it work.
Neucode.org
<suppressed key>
Back to top
View user's profile Send private message
azazello
n00b
n00b


Joined: 07 Apr 2005
Posts: 25

PostPosted: Fri Jun 10, 2005 11:07 pm    Post subject: Reply with quote

Quote:
IDE is not hot swappable by design.


IDE is perfectly hot-swappable if supported properly. Don't spread FUD about things you haven't used.

Modern chipsets have IDE hot-swap support. AFAIK to use it, you have to use only one device per bus (which is what laptops do). The software is responsible for powering down the drive and turning off the controller before giving an OK to the user to hot-swap the bay.

Linux certainly doesn't have good IDE hot-swap support (at least from the end user standpoint) compared to, say, Windows XP where such devices work flawlessly. As of 2.6.11, I don't think you can get the kernel to recognize the inserted device by modprobbing if there was no device in the bay at boot.

Here's what I did to get the best hot-swap support available on my IBM Thinkpad T40 with KDE installed:

Code:

# hdparm functionality for hotswapping Ultrabay devices is broken right now, but this works:
cd /root; wget http://users.ox.ac.uk/~univ1377/hotswap-0.4.0.tar.gz
tar xvzf hotswap-0.4.0.tar.gz; cd hotswap-0.4.0
./configure --disable-motif-frontend --prefix=/usr/kde/3.4/ && make && make install


This installs hotswap, which can swap an IDE device (by default /dev/hdc) for you. It has text and graphical front-ends.

Code:

echo '#!/bin/sh
umount -l /mnt/ntfs
umount -l /mnt/cdrom
hdparm -y /dev/hdc
/usr/kde/3.4/bin/hotswap --ide-controller=1 unregister-ide && echo eject > /proc/acpi/ibm/bay' > /etc/acpi/ubayeject.sh
echo '#!/bin/sh
/usr/kde/3.4/bin/hotswap --ide-controller=1 rescan-ide
/bin/mount -t ntfs -o rw,utf8,umask=0777 /dev/hdc1 /mnt/ntfs
/bin/mount -t iso9660 -o ro /dev/cdroms/cdrom0 /mnt/cdrom' > /etc/acpi/ubayinsert.sh

echo 'event=ibm/bay MSTR 00000003 00000000
action=/etc/acpi/ubayeject.sh' > /etc/acpi/events/ubayeject
echo 'event=ibm/bay MSTR 00000001 00000000
action=/etc/acpi/ubayinsert.sh' > /etc/acpi/events/ubayinsert


This is an ACPI script to respond when the user arms the Ultrabay eject lever. (Similar events should fire for other systems if you have proper ACPI support installed; you can get their ACPI event IDs by running

Code:

tail -f /var/log/acpid


and arming/disarming the lever.

Note that the ACPI script above uses hdparm to spin down the HDD (if it's an HDD) before removal (otherwise your HDD will be emergency-powered-off, which is bad for its drive heads) and ibm-acpi to power down the device bay (I don't know how to do that for other systems).

After doing this, I have a nice icon sitting in my tray for swapping out the device as well as all necessary actions firing when I arm the lever. However this support is absolutely not perfect - sometimes the hotswap backend fails because it can't power down the controller for some reason, and obviously if you have busy files on the FS then the unmount will fail.

I can't wait for the day when the kernel maintainers get around to writing proper IDE hotswap support and there's a single standard utility for it and a KDE front-end. It shouldn't be long though, and I'll try to work on it too.
Back to top
View user's profile Send private message
beatryder
Veteran
Veteran


Joined: 08 Apr 2005
Posts: 1138

PostPosted: Sat Jun 11, 2005 9:33 pm    Post subject: Reply with quote

Unfortunatley there is no acpi signal from the device.

I am considering trying to enable firewire support, on the odd chance it will work
_________________
Dont make it idiot proof, make it work.
Neucode.org
<suppressed key>
Back to top
View user's profile Send private message
gentuse
Tux's lil' helper
Tux's lil' helper


Joined: 15 Aug 2002
Posts: 75
Location: Seattle

PostPosted: Wed Jun 15, 2005 9:55 pm    Post subject: Reply with quote

beatryder wrote:
to my knowledge there are no SATA CD/DVD ROMs out there yet.

Technically, not a CD/DVD ROM since they are burners, but here are some SATA optical drives: http://www.newegg.com/Product/ProductList.asp?Manufactory=&PropertyCodeValue=0&PropertyCodeValue=0&PropertyCodeValue=0&PropertyCodeValue=0&PropertyCodeValue=0&PropertyCodeValue=0&PropertyCodeValue=0&PropertyCodeValue=0&PropertyCodeValue=0&PropertyCodeValue=0&PropertyCodeValue=0&PropertyCodeValue=0&PropertyCodeValue=0&PropertyCodeValue=384%3A6820&description=&MinPrice=&MaxPrice=&SubCategory=5&Submit=Property
Back to top
View user's profile Send private message
beatryder
Veteran
Veteran


Joined: 08 Apr 2005
Posts: 1138

PostPosted: Mon Jul 04, 2005 8:40 pm    Post subject: Reply with quote

Yeah, after some more playing around. I have my dvdrw working with no IDE drivers, only scsi and sata
_________________
Dont make it idiot proof, make it work.
Neucode.org
<suppressed key>
Back to top
View user's profile Send private message
heilong
n00b
n00b


Joined: 23 May 2005
Posts: 45

PostPosted: Fri Jul 08, 2005 7:29 am    Post subject: Reply with quote

I've got ThinkPad R51 and wanted to do the same thing. My partly working solution is to pass "hdc=cdrom" kernel boot parameter. This way, if I boot without cd-rom, I've got a lot of error messages on boot, but the cd-rom works if I insert it later. Problem - CDDA seems to not work.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum