diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2014-06-28 18:09:43 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2014-06-28 18:09:43 +0200 |
commit | 4275c49e72544d5b92512e41ddecbd6af5bee6c3 (patch) | |
tree | 22d66cc1e3286e69f50cc676e3c8e7fbd4b0636a /sys/man/2 | |
parent | d8c75e45de9483881f782be0b5e7113e625db571 (diff) |
nusb: implement aijus stable uniqueue device names
instead of naming devices by ther dynamically assigned device address,
we hash device uniqueue fields from the device descriptor and produce
a 5 digit hex string that will identify the device across machines.
when there is a collision (less than 1% chance with 100 devices),
usbd will append the device address to the name to make it uniqueue
for this machine.
the hname is passed to drivers in the devid argument, which now has
the form addr:hname, where the colon and hname can be omited (for backwards
compatibility).
when the new behaviour isnt desired, nousbhname= environment variable
can be defined giving the old behaviour.
Diffstat (limited to 'sys/man/2')
-rw-r--r-- | sys/man/2/nusb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/man/2/nusb b/sys/man/2/nusb index dfca0cf5c..681a76fbf 100644 --- a/sys/man/2/nusb +++ b/sys/man/2/nusb @@ -28,6 +28,7 @@ struct Dev { Usbdev* usb; /* USB description */ void* aux; /* for the device driver */ void (*free)(void*); /* idem. to release aux */ + char* hname; /* hash name, uniqueue for device */ }; .sp 0.3v struct Usbdev { @@ -119,7 +120,7 @@ Dev* openep(Dev *d, int id); int unstall(Dev *dev, Dev *ep, int dir); int usbcmd(Dev *d, int type, int req, int value, int index, uchar *data, int count); -Dev* getdev(int id); +Dev* getdev(char *devid); .sp 0.3v extern int usbdebug; /* more messages for bigger values */ .EE |