On Mon, Dec 17, 2001 at 12:48:50PM -0800, David Brownell wrote:
> > > Not true at all. If a driver knows where a device is, it can do more
> > > things. Currently no Linux driver cares about topology, but that might
> > > change in 2.5.
>
> In part because the topology info is not really available ... :)
static int usb_make_path(struct usb_device *dev, char *buf, int maxlen)
{
struct usb_device *pdev = dev->parent;
char *tmp, *port;
int i;
if (!(port = kmalloc(maxlen, GFP_KERNEL)))
return -1;
if (!(tmp = kmalloc(maxlen, GFP_KERNEL)))
return -1;
*port = 0;
while (pdev) {
for (i = 0; i < pdev->maxchild; i++)
if (pdev->children[i] == dev)
break;
if (pdev->children[i] != dev)
return -1;
strcpy(tmp, port);
sprintf(port, strlen(port) ? "%d.%s" : "%d", i + 1, tmp);
dev = pdev;
pdev = dev->parent;
}
sprintf(buf, "usb%d:%s", dev->bus->busnum, port);
return 0;
}
... could be added somewhere.
> > The new HID drivers do care and pass that info to the input core. And
> > it'll be very useful, namely for multihead and other fun stuff.
>
> Hmm, how do the HID drivers pass that info along?
As a string. Example from my system:
vojtech@twilight:~$ cat /proc/bus/input/devices
I: Bus=0003 Vendor=046d Product=c004 Version=0120
N: Name="Logitech USB-PS/2 Mouse"
P: Phys=usb1:2.2/input0
D: Drivers=mouse0 event1
B: EV=e
B: KEY=70000 0 0 0 0 0 0 0 0
B: REL=3
B: ABS=100 0
I: Bus=0003 Vendor=0430 Product=0005 Version=0101
N: Name="0430:0005"
P: Phys=usb1:2.3/input0
D: Drivers=kbd event0
B: EV=120002
B: KEY=10000 0 3e00000 7ff ffbeffdf ffffffff ffffffff fffffffe
B: LED=1f
The input drivers also create topology strings for non-USB devices,
like isa0060/serio0/input0 for keyboard, etc.
For USB it really should look like pci00:07.2/usb0:2.2/input0, but that's
yet to implement.
I hope this will integrate nicely with Mochel's work.
> I've got some hub patches pending; should I add some code
> to have the hub driver save that topology info in usb_device?
> Right now it calculates it for a diagnostic, but discards it after
> printing it.
>
> - Dave
>
>
--
Vojtech Pavlik
SuSE Labs
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel