Closed avrs-admin closed 2 years ago
Joerg Wunsch
Unfortunately, the enumeration using bus_number:device_number is very Linux-specific. For example, under FreeBSD 8 (and above), the equivalent names for all devices on one machine would look like:
bus_name:dev_name: /dev/usb:/dev/ugen1.2 bus_name:dev_name: /dev/usb:/dev/ugen0.4 bus_name:dev_name: /dev/usb:/dev/ugen0.3 bus_name:dev_name: /dev/usb:/dev/ugen0.2 bus_name:dev_name: /dev/usb:/dev/ugen1.1 bus_name:dev_name: /dev/usb:/dev/ugen0.1
No idea how it would look like under Windows.
I'd like to see that patch tuned in a way so the bus/device numbers can be given as just "-P usb:0.4", which would then translate into /proc/bus/000/004 under Linux, /dev/ugen0.4 under FreeBSD, and whatever is needed for it under Windows.
Too bad Lady Ada didn't implement serial numbers.
Joerg Wunsch
Just for the record: this is FreeBSD prior 8.x:
bus_name:dev_name: /dev/usb0:/dev/ugen0
(Only those devices on the bus which don't have a non-generic driver are displayed there, rather than the entire hierarchy.)
Joerg Wunsch
I'd like to see that patch tuned in a way so the bus/device numbers can be given as just "-P usb:0.4"
Well, Windows appears to use bus:device names like
bus-0/\.\libusb0-0001--0x03eb-0x2103
Looks too complicated to derive some kind of generic name from that.
My suggestions:
. Please don't mess with the code in main.c, at least not within a patch that is supposed to only affect the usbtiny. (A more generic per-programmer default device scheme would be welcome, but then, as a separate patch, please.)
. For consistency, please follow the -P usb convention as used by
other USB-based programmers. I.e., plain -P usb (which should be
the default fot the usbtiny) means "use the first matching device
found on the USB", and -P usb:
. When (at least) one -v option has been specified, make the code print out all candidate devices (i.e. everything where the VID/PID matches). That way, the user can get a list of all candidate devices by specifying a guaranteed to be invalid string for
Joerg Wunsch
Oops, the web interface eats up some backslashes. For reference, the Windows device names look like:
bus-0/\\.\libusb0-0001--0x03eb-0x2103
Grygoriy Fuchedzhy
. Please don't mess with the code in main.c, at
least not within a patch that is supposed to only affect the usbtiny.
done
. For consistency, please follow the -P usb convention as used by other USB-based programmers. I.e., plain -P usb (which should be the default fot the usbtiny) means "use the first matching device found on the USB", and -P usb:
means "use a specific device". For other USB-based programmers is the (trailing part of the) serial number, for the usbtiny, the idea to use the (OS-specific) bus/device pair has some merit.
done. Just like it was in previous patch bus is struct usb_bus::dirname. device is struct usb_device::filename. User always can look how they look like using -v option.
. When (at least) one -v option has been specified, make the code print out all candidate devices (i.e. everything where the VID/PID matches). That way, the user can get a list of all candidate devices by specifying a guaranteed to be invalid string for
; the documentation mentions "-v -P usb:xxx" as an example. The list of candidate devices that is printed then should be given in a way so the output can be copy&pasted into the commandline. Examples could look like:
done.
Please review and test as I can test using linux only. New patch is against avrdude-5.10 Thanks!
Joerg Wunsch
Thanks for the quick followup!
Documentation changes were still lacking, but I did that myself by now.
Added in r974.
Grygoriy Fuchedzhy
I have one minor correction to documentation you wrote, windows example in the example section is not correct: -P usb:bus-0/\.\libusb0-0001--0x1781-0x0c9f there should be one more ":" in that string, I think something like: -P usb:bus-0:\.\libusb0-0001--0x1781-0x0c9f
However I don't know how exactly it will look like on windows.
Grygoriy Fuchedzhy grygoriy.fuchedzhy@gmail.com Sat 04 Dec 2010 11:25:53 AM UTC
I'm using usbtiny programmers.
Now there isn't way to specify which programmer exactly to use via avrdude if there are several usbtinyisp programmers connected to my computer.
So I decided to use -P option to specify which one to use, preserving behavior when no -P option given.
Patch against avrdude-5.10 attached.
Example of usage:
callisto ~ $ lsusb | grep '1781:0c9f' Bus 005 Device 123: ID 1781:0c9f Multiple Vendors Bus 005 Device 122: ID 1781:0c9f Multiple Vendors callisto ~ $ avrdude -c usbtiny -p m8 -P 005:123
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.01s
avrdude: Device signature = 0x1e9307
avrdude: safemode: Fuses OK
avrdude done. Thank you.
file #22122: usbtiny-port.patch file #23824: 0001-added-addressing-of-usbtiny-with-P-option.patch
This issue was migrated from https://savannah.nongnu.org/bugs/?31779