* [gentoo-user] Need to identify USB device by port
@ 2007-04-04 23:39 Mike Diehl
2007-04-05 16:06 ` ds
0 siblings, 1 reply; 5+ messages in thread
From: Mike Diehl @ 2007-04-04 23:39 UTC (permalink / raw
To: gentoo-user
Hi all.
I need to identify a device using udev by looking at which USB port it is
plugged into. The device doesn't have a serial number and I've got two of
the same type of device which I need to discriminage against.
My first try was a udev rule like: (each on one line.)
BUS=="usb" SYMLINK="mouse_1" SYSFS{manufacturer}=="Logitech"
PHYSDEVPATH=="*:00:02.0/usb2/2-9" OPTIONS+="last_rule"
BUS=="usb" SYMLINK="mouse_2" SYSFS{manufacturer}=="Logitech"
PHYSDEVPATH=="*:00:02.0/usb2/2-10" OPTIONS+="last_rule"
When I plug them in, I get:
===========================================
Apr 4 17:34:58 localhost kernel: usb 2-9: new low speed USB device using
ohci_hcd and address 37
Apr 4 17:34:58 localhost kernel: usb 2-9: configuration #1 chosen from 1
choice
Apr 4 17:34:58 localhost kernel: input: Logitech USB-PS/2 Optical Mouse
as /class/input/input35
Apr 4 17:34:58 localhost kernel: input: USB HID v1.10 Mouse [Logitech
USB-PS/2 Optical Mouse] on usb-0000:00:02.0-9
===========================================
and
===========================================
Apr 4 17:39:10 localhost kernel: usb 2-10: new low speed USB device using
ohci_hcd and address 38
Apr 4 17:39:11 localhost kernel: usb 2-10: configuration #1 chosen from 1
choice
Apr 4 17:39:11 localhost kernel: input: Logitech USB-PS/2 Optical Mouse
as /class/input/input36
Apr 4 17:39:11 localhost kernel: input: USB HID v1.10 Mouse [Logitech
USB-PS/2 Optical Mouse] on usb-0000:00:02.0-10
===========================================
Any ideas about what I'm doing wrong?
TIA,
--
Mike Diehl
--
gentoo-user@gentoo.org mailing list
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [gentoo-user] Need to identify USB device by port
2007-04-04 23:39 [gentoo-user] Need to identify USB device by port Mike Diehl
@ 2007-04-05 16:06 ` ds
2007-04-06 1:46 ` Mike Diehl
0 siblings, 1 reply; 5+ messages in thread
From: ds @ 2007-04-05 16:06 UTC (permalink / raw
To: gentoo-user
On 4/4/07, Mike Diehl <mdiehl@diehlnet.com> wrote:
>
> My first try was a udev rule like: (each on one line.)
>
> BUS=="usb" SYMLINK="mouse_1" SYSFS{manufacturer}=="Logitech"
> PHYSDEVPATH=="*:00:02.0/usb2/2-9" OPTIONS+="last_rule"
>
> BUS=="usb" SYMLINK="mouse_2" SYSFS{manufacturer}=="Logitech"
> PHYSDEVPATH=="*:00:02.0/usb2/2-10" OPTIONS+="last_rule"
I just happened to have read a webpage on writing udev rules yesterday:
http://www.reactivated.net/writing_udev_rules.html
First, it looks like the udev rules are supposed to be separated by
comma, and second the symlink assignment key should use the += syntax.
I think your first rule should look like this:
BUS=="usb", SYMLINK+="mouse_1", SYSFS{manufacturer}=="Logitech",
PHYSDEVPATH=="*:00:02.0/usb2/2-9", OPTIONS+="last_rule"
Other than this, I cannot verify the accuracy of any of your values.
When I get home I will see what my logitech mouse looks like in sysfs
Hope this helps,
--
ds
--
gentoo-user@gentoo.org mailing list
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [gentoo-user] Need to identify USB device by port
2007-04-05 16:06 ` ds
@ 2007-04-06 1:46 ` Mike Diehl
2007-04-06 4:39 ` Walter Dnes
0 siblings, 1 reply; 5+ messages in thread
From: Mike Diehl @ 2007-04-06 1:46 UTC (permalink / raw
To: gentoo-user
Well, I changed my rule per your advice:
BUS=="usb", SYMLINK+="mouse1", SYSFS{manufacturer}=="Logitech",
OPTIONS+="last_rule", PHYSDEVPATH=="*:00:02.0/usb2/2-10"
And it STILL doesn't work. I've googled and read everything I can find. It
looks like my PHYSDEVPATH isn't correct. I've got one rule for each of my
two mice and it seems like the first one always matches, eventhough I've used
different PHYSDEVPATH's...
Any ideas are much appreciated.
Mike.
On Thursday 05 April 2007 10:06, ds wrote:
> On 4/4/07, Mike Diehl <mdiehl@diehlnet.com> wrote:
> > My first try was a udev rule like: (each on one line.)
> >
> > BUS=="usb" SYMLINK="mouse_1" SYSFS{manufacturer}=="Logitech"
> > PHYSDEVPATH=="*:00:02.0/usb2/2-9" OPTIONS+="last_rule"
> >
> > BUS=="usb" SYMLINK="mouse_2" SYSFS{manufacturer}=="Logitech"
> > PHYSDEVPATH=="*:00:02.0/usb2/2-10" OPTIONS+="last_rule"
>
> I just happened to have read a webpage on writing udev rules yesterday:
> http://www.reactivated.net/writing_udev_rules.html
> First, it looks like the udev rules are supposed to be separated by
> comma, and second the symlink assignment key should use the += syntax.
> I think your first rule should look like this:
>
> BUS=="usb", SYMLINK+="mouse_1", SYSFS{manufacturer}=="Logitech",
> PHYSDEVPATH=="*:00:02.0/usb2/2-9", OPTIONS+="last_rule"
>
> Other than this, I cannot verify the accuracy of any of your values.
> When I get home I will see what my logitech mouse looks like in sysfs
>
> Hope this helps,
> --
> ds
--
Mike Diehl
--
gentoo-user@gentoo.org mailing list
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [gentoo-user] Need to identify USB device by port
2007-04-06 1:46 ` Mike Diehl
@ 2007-04-06 4:39 ` Walter Dnes
2007-04-06 5:11 ` Mike Diehl
0 siblings, 1 reply; 5+ messages in thread
From: Walter Dnes @ 2007-04-06 4:39 UTC (permalink / raw
To: gentoo-user
On Thu, Apr 05, 2007 at 07:46:45PM -0600, Mike Diehl wrote
> OPTIONS+="last_rule", PHYSDEVPATH=="*:00:02.0/usb2/2-10"
> Any ideas are much appreciated.
Are you sure both PHYSDEVPATHs contain "00:02.0"?
Anyhow, let's dig into this a bit deeper...
- go into text console mode (e.g. tty1)
- unplug both mice
- execute (without the quotes) "ll -R /dev/ > x1"
- insert the 1st mouse and wait 60 seconds
- execute (without the quotes) "ll -R /dev/ > x2"
- insert the 2nd mouse and wait 60 seconds
- execute (without the quotes) "ll -R /dev/ > x3"
- execute (without the quotes) "diff x1 x2 > mouse1.txt"
- execute (without the quotes) "diff x2 x3 > mouse2.txt"
Attach the output files mouse1.txt and mouse2.txt and email to this
list. It'll show us where the mice appear in your /dev directory. Once
we see the output, we'll proceed from there.
--
Walter Dnes <waltdnes@waltdnes.org> In linux /sbin/init is Job #1
Q. Mr. Ghandi, what do you think of Microsoft security?
A. I think it would be a good idea.
--
gentoo-user@gentoo.org mailing list
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [gentoo-user] Need to identify USB device by port
2007-04-06 4:39 ` Walter Dnes
@ 2007-04-06 5:11 ` Mike Diehl
0 siblings, 0 replies; 5+ messages in thread
From: Mike Diehl @ 2007-04-06 5:11 UTC (permalink / raw
To: gentoo-user
Here is the output of those command:
mouse1:
================================
19a20,22
> usbdev2.56_ep81
> usbdev2.56_ep00
> usbdev2.56
645a649
> mouse0
664a669
> his_mouse
671a677
> event2
================================
================================
19a20,22
> usbdev2.57_ep81
> usbdev2.57_ep00
> usbdev2.57
648a652
> mouse1
676a681
> event3
sh-3.1$
================================
...eagerly awaiting further instruction....
Now, on the off chance that you meant to use /sys and not /dev, I've made the
output available at http://www.diehlnet.com/mouse1.txt and
http://www.diehlnet.com/mouse2.txt
Thank you for your time.
Mike.
On Thursday 05 April 2007 22:39, Walter Dnes wrote:
> On Thu, Apr 05, 2007 at 07:46:45PM -0600, Mike Diehl wrote
>
> > OPTIONS+="last_rule", PHYSDEVPATH=="*:00:02.0/usb2/2-10"
> >
> > Any ideas are much appreciated.
>
> Are you sure both PHYSDEVPATHs contain "00:02.0"?
>
> Anyhow, let's dig into this a bit deeper...
>
> - go into text console mode (e.g. tty1)
> - unplug both mice
> - execute (without the quotes) "ll -R /dev/ > x1"
> - insert the 1st mouse and wait 60 seconds
> - execute (without the quotes) "ll -R /dev/ > x2"
> - insert the 2nd mouse and wait 60 seconds
> - execute (without the quotes) "ll -R /dev/ > x3"
> - execute (without the quotes) "diff x1 x2 > mouse1.txt"
> - execute (without the quotes) "diff x2 x3 > mouse2.txt"
>
> Attach the output files mouse1.txt and mouse2.txt and email to this
> list. It'll show us where the mice appear in your /dev directory. Once
> we see the output, we'll proceed from there.
>
> --
> Walter Dnes <waltdnes@waltdnes.org> In linux /sbin/init is Job #1
> Q. Mr. Ghandi, what do you think of Microsoft security?
> A. I think it would be a good idea.
--
Mike Diehl
--
gentoo-user@gentoo.org mailing list
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-04-06 5:17 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-04 23:39 [gentoo-user] Need to identify USB device by port Mike Diehl
2007-04-05 16:06 ` ds
2007-04-06 1:46 ` Mike Diehl
2007-04-06 4:39 ` Walter Dnes
2007-04-06 5:11 ` Mike Diehl
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox