View previous topic :: View next topic |
Author |
Message |
kamagurka Veteran


Joined: 25 Jan 2004 Posts: 1026 Location: /germany/munich
|
Posted: Wed Feb 23, 2005 5:26 pm Post subject: udev rules problems [solved] |
|
|
I am trying to get my iRiver H340 player (that as far as I know behaves pretty much like a portable USB hard drive) mapped to always the same device node so I can mount it per fstab. Of course, I am doing this by writing an appropriate udev rule for it. What's strange is that after writing the rule, mounting worked a few times, but now I always get Code: | mount: /dev/iriver is not a block device |
I am using this rule in /etc/udev/rules.d/10-local.rules to have the device mapped to the symlink /dev/iriver
Code: | SYSFS{vendor}="TOSHIBA ", SYSFS{model}="MK4004GAH ", NAME="%k", SYMLINK="iriver" |
However, the created symlink points to /dev/sg0; the device is at /dev/sda1, for crying out loud. I don't understand.
Here's the /var/log/messages output when I plug the device in:
Code: | Feb 23 18:15:01 kumquad usb 1-2: new full speed USB device using uhci_hcd and address 22
Feb 23 18:15:01 kumquad scsi19 : SCSI emulation for USB Mass Storage devices
Feb 23 18:15:01 kumquad usb-storage: device found at 22
Feb 23 18:15:01 kumquad usb-storage: waiting for device to settle before scanning
Feb 23 18:15:06 kumquad Vendor: TOSHIBA Model: MK4004GAH Rev: JC00
Feb 23 18:15:06 kumquad Type: Direct-Access ANSI SCSI revision: 00
Feb 23 18:15:06 kumquad SCSI device sda: 78126048 512-byte hdwr sectors (40001 MB)
Feb 23 18:15:06 kumquad sda: assuming drive cache: write through
Feb 23 18:15:06 kumquad SCSI device sda: 78126048 512-byte hdwr sectors (40001 MB)
Feb 23 18:15:06 kumquad sda: assuming drive cache: write through
Feb 23 18:15:07 kumquad sda: sda1
Feb 23 18:15:07 kumquad Attached scsi disk sda at scsi19, channel 0, id 0, lun 0
Feb 23 18:15:07 kumquad Attached scsi generic sg0 at scsi19, channel 0, id 0, lun 0, type 0
Feb 23 18:15:07 kumquad usb-storage: device scan complete
Feb 23 18:15:07 kumquad scsi.agent[32448]: disk at /devices/pci0000:00/0000:00:07.2/usb1/1-2/1-2:2.0/host19/target19:0:0/19:0:0:0 |
And here's the walk along the device chain by udevinfo:
Code: | # udevinfo -a -p /devices/pci0000:00/0000:00:07.2/usb1/1-2/1-2:2.0/host19/target19:0:0/19:0:0:0
udevinfo starts with the device the node belongs to and then walks up the
device chain, to print for every device found, all possibly useful attributes
in the udev key format.
Only attributes within one device section may be used together in one rule,
to match the device for which the node will be created.
looking at class device '/sys/devices/pci0000:00/0000:00:07.2/usb1/1-2/1-2:2.0/host19/target19:0:0/19:0:0:0':
SYSFS{detach_state}="0"
SYSFS{device_blocked}="0"
SYSFS{max_sectors}="240"
SYSFS{model}="MK4004GAH "
SYSFS{queue_depth}="1"
SYSFS{rev}="JC00"
SYSFS{scsi_level}="3"
SYSFS{state}="running"
SYSFS{timeout}="30"
SYSFS{type}="0"
SYSFS{vendor}="TOSHIBA " |
As far as I can see I did everything just as the udev guide said, but since this is my first time writing a udev rule, it's very possible I wielded udevinfo incorrectly, or misunderstood the information there or in /var/log/messages, so I am very thankful for any suggestions.
PS: udevinfo reports the following on the node /dev/sda1 (which is where my player is)
Code: | # udevinfo -q all -n /dev/sda1
P: /block/sda/sda1
N: sda1
T: b
M: 060660
S: iriver
O: root
G: disk
F: /etc/udev/rules.d/10-local.rules
L: 2
U: 763594 |
so udev clearly believes to have created a symlink pointing to /dev/sda1. But, as I already stated, /dev/iriver points to /dev/sg0. _________________ If you loved me, you'd all kill yourselves today.
--Spider Jerusalem, the Word
Last edited by kamagurka on Sun Feb 27, 2005 3:28 pm; edited 1 time in total |
|
Back to top |
|
 |
kamagurka Veteran


Joined: 25 Jan 2004 Posts: 1026 Location: /germany/munich
|
Posted: Sun Feb 27, 2005 2:31 pm Post subject: |
|
|
As of yet unsolved. _________________ If you loved me, you'd all kill yourselves today.
--Spider Jerusalem, the Word |
|
Back to top |
|
 |
manny15 Guru


Joined: 01 Dec 2002 Posts: 473 Location: USA
|
Posted: Sun Feb 27, 2005 3:05 pm Post subject: |
|
|
I had a similar problem with my USB zip drive and my usb HD. Here's what has worked so far:
Code: |
BUS="usb", KERNEL="sd*4", SYSFS{idVendor}="059b", SYSFS{idProduct}="0032", NAME=
"%k", SYMLINK="zip"
BUS="usb", KERNEL="sd*1", SYSFS{idVendor}="1058", SYSFS{idProduct}="0100", NAME=
"%k", SYMLINK="usbhd"
|
Notice I specified the partition number in KERNEL="sd*[partition]" that way the symlink that gets created points to the partition and not the entire block device. |
|
Back to top |
|
 |
Naib Watchman


Joined: 21 May 2004 Posts: 6073 Location: Removed by Neddy
|
Posted: Sun Feb 27, 2005 3:06 pm Post subject: Re: udev rules problems |
|
|
kamagurka wrote: | I am trying to get my iRiver H340 player (that as far as I know behaves pretty much like a portable USB hard drive) mapped to always the same device node so I can mount it per fstab. Of course, I am doing this by writing an appropriate udev rule for it. What's strange is that after writing the rule, mounting worked a few times, but now I always get Code: | mount: /dev/iriver is not a block device |
I am using this rule in /etc/udev/rules.d/10-local.rules to have the device mapped to the symlink /dev/iriver
Code: | SYSFS{vendor}="TOSHIBA ", SYSFS{model}="MK4004GAH ", NAME="%k", SYMLINK="iriver" |
|
When I insert my USB stick I get a sg0 device and a sda1 device
This is my rule for it
Quote: |
BUS="scsi", KERNEL="sd*", SYSFS(serial)="B8177840FE1CB499", NAME="%k", SYMLINK="usbkey"
|
note the KERNEL="sd*" part
If you add that to the rule it will force the rule to only be valid for a /dev node named as such not the first node the device creates (chich is the sg0 node)
that should work. The fact that the iriver symlink is being created shows that the rule is fuctioning correctly, it just missing this bit-o-info _________________ #define HelloWorld int
#define Int main()
#define Return printf
#define Print return
#include <stdio>
HelloWorld Int {
Return("Hello, world!\n");
Print 0; |
|
Back to top |
|
 |
Naib Watchman


Joined: 21 May 2004 Posts: 6073 Location: Removed by Neddy
|
Posted: Sun Feb 27, 2005 3:06 pm Post subject: |
|
|
damb beaten to it _________________ #define HelloWorld int
#define Int main()
#define Return printf
#define Print return
#include <stdio>
HelloWorld Int {
Return("Hello, world!\n");
Print 0; |
|
Back to top |
|
 |
kamagurka Veteran


Joined: 25 Jan 2004 Posts: 1026 Location: /germany/munich
|
Posted: Sun Feb 27, 2005 3:28 pm Post subject: |
|
|
YES! So that's what that KERNEL option means. Thanks to both of you. _________________ If you loved me, you'd all kill yourselves today.
--Spider Jerusalem, the Word |
|
Back to top |
|
 |
|
|
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
|
|