You are not logged in.

#1 2010-08-22 20:47:00

hamelg
Member
From: France
Registered: 2008-06-19
Posts: 128

[SOLVED] udev/hald issue on optical media

Hello,

Today, I have upgraded udev :
upgraded udev (160-1 -> 161-1)

Now, the kde device notifier detects no more some optical media I had inserted in
I'm running kdemod 4.4.5.

revert back to 160-1 fixes that.

Last edited by hamelg (2010-08-26 19:43:56)

Offline

#2 2010-08-23 21:06:14

hamelg
Member
From: France
Registered: 2008-06-19
Posts: 128

Re: [SOLVED] udev/hald issue on optical media

I did tests and I found out that only device not labeled are not detected.
With udev 160, cdrom with no label appeared in the plug-in device list as CD-R.

Offline

#3 2010-08-24 12:16:15

Wattanut
Member
From: London
Registered: 2009-01-29
Posts: 6

Re: [SOLVED] udev/hald issue on optical media

Thanks for the info, thought I was going mad this morning trying to read one of my cd-r's. Nautilus kept telling me it was blank.

Offline

#4 2010-08-24 21:16:20

hamelg
Member
From: France
Registered: 2008-06-19
Posts: 128

Re: [SOLVED] udev/hald issue on optical media

hamelg wrote:

I did tests and I found out that only device not labeled are not detected.
With udev 160, cdrom with no label appeared in the plug-in device list as CD-R.

Actually, the issue is not related to the label, but to the type of media.
When I set hald in debug mode, I get this error when inserting a not detected CD :

[18976]: 22:59:18.017 [D] probe-storage.c:142: Doing probe-storage for /dev/sr0 (bus pci) (drive_type cdrom) (udi=/org/freedesktop/Hal/devices/storage_model_CDDVDW_SH_S223B) (--only-check-for-fs==1)
[18976]: 22:59:18.017 [D] probe-storage.c:193: Doing open ("/dev/sr0", O_RDONLY | O_NONBLOCK)
[18976]: 22:59:18.017 [D] probe-storage.c:199: Returned from open(2)
[18976]: 22:59:18.023 [D] probe-storage.c:343: Checking for optical disc on /dev/sr0
[18976]: 22:59:18.023 [D] probe-storage.c:351: Doing open ("/dev/sr0", O_RDONLY | O_NONBLOCK | O_EXCL)
[18976]: 22:59:18.023 [D] probe-storage.c:363: Open failed - Device Busy
[18976]: 22:59:18.123 [D] probe-storage.c:367: Attempting open w/ O_EXCL again
[18976]: 22:59:18.223 [D] probe-storage.c:367: Attempting open w/ O_EXCL again
[18976]: 22:59:18.323 [D] probe-storage.c:367: Attempting open w/ O_EXCL again
[18976]: 22:59:18.424 [D] probe-storage.c:367: Attempting open w/ O_EXCL again
[18976]: 22:59:18.524 [D] probe-storage.c:367: Attempting open w/ O_EXCL again
[18976]: 22:59:18.524 [D] probe-storage.c:378: open failed for /dev/sr0: Device or resource busy

It seems there is a race condition with /lib/udev/cdrom_id launched by udev.

Offline

#5 2010-08-26 19:42:35

hamelg
Member
From: France
Registered: 2008-06-19
Posts: 128

Re: [SOLVED] udev/hald issue on optical media

Ok, understood what's happen, here is the story. smile

The symptom is some CDs are detected by hald, others not.

When a CD/DVD is inserted or removed, the CD driver sends a message to udev to notify it a media change event. CD driver can do it because my CD device supports Asynchronous Notification (AN). Only recent CD/DVD drive supports this feature.

So, udev gets the event and processes it by probing the cdrom media (dvd or cd or cdrw ? Multi-session ? read labels ...).
To prob, udev rules execute utilities like /lib/udev/cdrom_id, /lib/udev/blkid which access the device.

At the same time, hald wakes up and see that media has changed and decides to probe so. HAL CD probing is enabled by default (see hal-disable-polling man pages).

Here is the race condition, but why HAL is not aware that my CD/DVD device supports AN ?

$ lshal  -u /org/freedesktop/Hal/devices/storage_model_CDDVDW_SH_S223B  | grep support_async_notification
  storage.removable.support_async_notification = false  (bool)

hal gets this information from sysfs in the block class, capability attribute. The bit #3 means AN supported.
The driver doesn't set this bit for my device, but it should.

A quick search on google, and I find that :

https://patchwork.kernel.org/patch/53022/

The bug is known, a fix has been proposed but it is not present in the current kernel.
So, fortunately hal allows to override informations on device objects. To fix the issue, I have put the following file in the directory /etc/hal/fdi/information :

<?xml version="1.0" encoding="UTF-8"?>

<deviceinfo version="0.2">
  <device>
    <match key="info.udi" string="/org/freedesktop/Hal/devices/storage_model_CDDVDW_SH_S223B">
      <merge key="storage.removable.support_async_notification" type="bool">true</merge>
    </match>
  </device>
</deviceinfo>

It stays a last question :
Why does udev 161 reveal the issue ?
A diff with udev 160 shows modifications in probing method. cdrom_id takes more time to probe that causes conflicting access.

Last edited by hamelg (2010-08-26 19:47:41)

Offline

Board footer

Powered by FluxBB