Gentoo Archives: gentoo-user

From: Song Zhiwei <songzw@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] How to set udev rule?
Date: Thu, 27 Aug 2009 20:42:35
Message-Id: e8dc92830908271851q5fc92b83v9945d52581761c31@mail.gmail.com
In Reply to: Re: [gentoo-user] How to set udev rule? by KH
1 Actually, I have read the guilds and tried, but it didnot work. So I asked here.
2
3 Two devices related with "can usb" were found when I used the udevadm:
4
5 #udevadm info -a -p /sys/devices/pci0000\:00/0000\:00\:0f.4/usb2/2-
6 2/2-2\:1.0
7 looking at device '/devices/pci0000:00/0000:00:0f.4/usb2/2-2/2-2:1.0':
8 KERNEL=="2-2:1.0"
9 SUBSYSTEM=="usb"
10 DRIVER=="CAN_USB331"
11 ATTR{bInterfaceNumber}=="00"
12 ATTR{bAlternateSetting}==" 0"
13 ATTR{bNumEndpoints}=="04"
14 ATTR{bInterfaceClass}=="00"
15 ATTR{bInterfaceSubClass}=="00"
16 ATTR{bInterfaceProtocol}=="00"
17 ATTR{modalias}=="usb:v0AB4p0001d0002dc00dsc00dp00ic00isc00ip00"
18
19 looking at parent device '/devices/pci0000:00/0000:00:0f.4/usb2/2-2':
20 KERNELS=="2-2"
21 SUBSYSTEMS=="usb"
22 DRIVERS=="usb"
23 ATTRS{configuration}==""
24 ATTRS{bNumInterfaces}==" 1"
25 ATTRS{bConfigurationValue}=="1"
26 ATTRS{bmAttributes}=="80"
27 ATTRS{bMaxPower}=="500mA"
28 ATTRS{urbnum}=="20"
29 ATTRS{idVendor}=="0ab4"
30 ATTRS{idProduct}=="0001"
31 ATTRS{bcdDevice}=="0002"
32 ATTRS{bDeviceClass}=="00"
33 ATTRS{bDeviceSubClass}=="00"
34 ATTRS{bDeviceProtocol}=="00"
35 ATTRS{bNumConfigurations}=="1"
36 ATTRS{bMaxPacketSize0}=="16"
37 ATTRS{speed}=="12"
38 ATTRS{busnum}=="2"
39 ATTRS{devnum}=="2"
40 ATTRS{version}==" 1.00"
41 ATTRS{maxchild}=="0"
42 ATTRS{quirks}=="0x0"
43 ATTRS{authorized}=="1"
44 ATTRS{manufacturer}=="esd-gmbh"
45 ATTRS{product}=="CAN-USB 543"
46 ATTRS{serial}=="GD001494"
47
48 The module was loaded by an alias in /etc/modules.d/esdcan:
49 alias char-major-50 esdcan-usb331
50 But I cannot find the major:minor informations in the udev info above.
51
52 I tried the rules:
53 SUBSYSTEM=="usb", DRIVER=="CAN_USB331", ATTR{serial}=="GD001494", NAME="can0"
54 SUBSYSTEM=="usb", DRIVER=="CAN_USB331", NAME="can0"
55 DRIVER=="CAN_USB331", NAME="can0"
56 and
57 SUBSYSTEM=="usb", ATTR{serial}=="GD001494", NAME="can%n"
58 But any one of them does not work.
59
60 Anyone can help me?
61
62
63 2009/8/27 KH <gentoo-user@××××××××××××××××.de>:
64 > Song Zhiwei schrieb:
65 >> Hi all,
66 >>
67 >> I complied a driver esdcan_usb331.so. I'd like use udev to create
68 >> character devices /dev/can0 and /dev/can1 with major 50 and minor 0/1
69 >> for the driver. How to write the udev rule for it?
70 >>
71 >> The dmesg is:
72 >> esd CAN driver: CAN_USB331
73 >> esd CAN driver: baudrate not set
74 >> esd CAN driver: mode = 0x00000000, major = 50, verbose = 0x00000001
75 >> esd CAN driver: version 3.8.3 06:03:32 Aug 24 2009: successfully loaded
76 >> usbcore: registered new interface driver CAN_USB331
77 >>
78 >
79 > Hi,
80 >
81 > there are two good guides for this:
82 >
83 > http://www.gentoo.org/doc/en/udev-guide.xml
84 > http://www.reactivated.net/writing_udev_rules.html
85 >
86 > Regards kh
87 >
88 >

Replies

Subject Author
Re: [gentoo-user] How to set udev rule? David Relson <relson@×××××××××××××.com>