1 |
On Sat, 9 Nov 2013 12:29:49 +0000 (UTC) |
2 |
Duncan <1i5t5.duncan@×××.net> wrote: |
3 |
|
4 |
> |
5 |
> udev creates usb devices in /dev/bus/usb. Each usb port is a (three-digit |
6 |
> sequentially numbered) directory, |
7 |
> Libusb, meanwhile, has been updated to work with the /dev/bus/usb/ tree, |
8 |
> so AFAIK that's what you need to create... somehow. |
9 |
> |
10 |
|
11 |
On Sat, 9 Nov 2013 16:11:48 -0600 |
12 |
Barry Schwartz <chemoelectric@×××××××××××××.org> wrote: |
13 |
|
14 |
> |
15 |
> Maybe you can run it once even as a non-daemon just to create the |
16 |
> device, similarly to running rescan-scsi-bus. |
17 |
> |
18 |
|
19 |
Well, it works! That is, I can start udev as a daemon, plug in my |
20 |
scanner, and udev will tell me what the major and minor numbers of the |
21 |
scanner device node. Then I can use my scanner with libusb and SANE. |
22 |
|
23 |
I thought that udev would also create the device node, but for some |
24 |
reason it does not. However, I can create the device manually in the /dev |
25 |
tree and then SANE is able to detect the scanner. |
26 |
|
27 |
Thanks especially to Duncan for his info on the /dev/bus/usb/001 ... |
28 |
location. I can manually create, for example, /dev/bus/usb/001 |
29 |
using the major/minor numbers reported by udev. Then I am in |
30 |
business for scanning. |
31 |
|
32 |
Actually, I can just create a whole series of nodes under /dev/bus/usb |
33 |
with the same major number and an incremental minor number. This |
34 |
will eliminate the need to use udev entirely. Whenever I plug in my |
35 |
scanner one of those nodes will be relevant. |
36 |
|
37 |
But the whole process illustrates that udev is not really necessary. |
38 |
The scanner is accessed through a device node in the /dev tree |
39 |
and there is no reason why udev must create this node. As long |
40 |
as the major/minor numbers are known (and the char or block characteristic) |
41 |
then anything can create the node. IOW, the kernel access is the |
42 |
same as always. Only these user space programs impose these node |
43 |
constraints. |
44 |
|
45 |
I wonder if I can determine the major/minor numbers in some other way. |
46 |
Maybe the /sys tree has that information. If so, then I could |
47 |
completely script the process without using udev. |
48 |
|
49 |
Thanks to all for the contribution. |
50 |
|
51 |
Frank Peters |