Closed petervanderwalt closed 1 year ago
Hi there, thanks for requesting support for this device. I went ahead and added support for passing in custom vendor and product ids to this library. I have updated the README file in this repo with a section on how to use this new functionality. Could you please give that a try and let me know if that works for you?
Thanks and have a great day!
Now thats a much more elegant solution! Thank you sooooo much! I'll give it a go shortly (work has me working on other things right at this moment, so will be sneaking in some time soon to revisit) - really do appreciate it. Have a great one and many thanks for all you do for the world!
At last work has me back on this task (: almost gone stale over here been itching to test it.
I know theres like a 101% chance its me being stupid, but I keep getting
Error: could not find requested device.
at usbtiny.open (C:\Users\User\Desktop\avrgirlisp\node_modules\usbtinyisp\index.js:36:15)
with a simple test script
const usbtinyisp = require('avrgirl-usbtinyisp');
const chips = require('avrgirl-chips-json');
let avrgirl = new usbtinyisp({
debug: true,
chip: chips.atmega328p,
programmer: 'custom',
pid: '0C9F',
vid: '1781'
});
avrgirl.on('ready', function() {
console.log('ready');
avrgirl.getChipSignature(function(error, signature) {
console.log(signature);
});
});
I did some digging using node-usb (as I can see its not your awesome library, node-usb isnt getting the device back from
var device = usb.findByIds(this.options.vid, this.options.pid);
if (!device) {
return cb(new Error('could not find requested device.'));
}
I ran a test with just node-usb (Sorry I know this isnt your problem now but just asking if maybe you have any ideas)
var usb = require('usb');
usb.setDebugLevel(4)
var list = usb.getDeviceList()
console.log(list)
var device = usb.findByIds("1781", "0C9F");
if (!device) {
console.log("Ebay USBTinyISP not found");
} else {
console.log(device);
}
Which returns all my USB devices, except the USBtinyISP?
$ node test.js
[timestamp] [threadID] facility level [function call] <message>
--------------------------------------------------------------------------------
[ 0.210000] [00001ca0] libusb: debug [libusb_get_device_list]
[ 0.210000] [00001ca0] libusb: debug [libusb_get_device_descriptor]
[ 0.210000] [00001ca0] libusb: debug [libusb_get_device_descriptor]
[ 0.210000] [00001ca0] libusb: debug [libusb_get_device_descriptor]
[ 0.210000] [00001ca0] libusb: debug [libusb_get_device_descriptor]
[ 0.210000] [00001ca0] libusb: debug [libusb_get_device_descriptor]
[ 0.210000] [00001ca0] libusb: debug [libusb_get_device_descriptor]
[ 0.210000] [00001ca0] libusb: debug [libusb_get_device_descriptor]
[ 0.210000] [00001ca0] libusb: debug [libusb_get_device_descriptor]
[ Device {
busNumber: 2,
deviceAddress: 5,
deviceDescriptor:
{ bLength: 18,
bDescriptorType: 1,
bcdUSB: 272,
bDeviceClass: 0,
bDeviceSubClass: 0,
bDeviceProtocol: 0,
bMaxPacketSize0: 8,
idVendor: 7247,
idProduct: 38,
bcdDevice: 272,
iManufacturer: 1,
iProduct: 2,
iSerialNumber: 0,
bNumConfigurations: 1 },
portNumbers: [ 1, 3 ] },
Device {
busNumber: 2,
deviceAddress: 3,
deviceDescriptor:
{ bLength: 18,
bDescriptorType: 1,
bcdUSB: 272,
bDeviceClass: 0,
bDeviceSubClass: 0,
bDeviceProtocol: 0,
bMaxPacketSize0: 8,
idVendor: 6017,
idProduct: 3231,
bcdDevice: 260,
iManufacturer: 0,
iProduct: 2,
iSerialNumber: 0,
bNumConfigurations: 1 },
portNumbers: [ 1, 1 ] },
Device {
busNumber: 2,
deviceAddress: 6,
deviceDescriptor:
{ bLength: 18,
bDescriptorType: 1,
bcdUSB: 512,
bDeviceClass: 0,
bDeviceSubClass: 0,
bDeviceProtocol: 0,
bMaxPacketSize0: 8,
idVendor: 1133,
idProduct: 49271,
bcdDevice: 29184,
iManufacturer: 1,
iProduct: 2,
iSerialNumber: 0,
bNumConfigurations: 1 },
portNumbers: [ 1, 4 ] },
Device {
busNumber: 2,
deviceAddress: 4,
deviceDescriptor:
{ bLength: 18,
bDescriptorType: 1,
bcdUSB: 512,
bDeviceClass: 239,
bDeviceSubClass: 2,
bDeviceProtocol: 1,
bMaxPacketSize0: 64,
idVendor: 1133,
idProduct: 2140,
bcdDevice: 22,
iManufacturer: 0,
iProduct: 2,
iSerialNumber: 1,
bNumConfigurations: 1 },
portNumbers: [ 1, 2 ] },
Device {
busNumber: 2,
deviceAddress: 2,
deviceDescriptor:
{ bLength: 18,
bDescriptorType: 1,
bcdUSB: 512,
bDeviceClass: 9,
bDeviceSubClass: 0,
bDeviceProtocol: 1,
bMaxPacketSize0: 64,
idVendor: 32903,
idProduct: 36,
bcdDevice: 0,
iManufacturer: 0,
iProduct: 0,
iSerialNumber: 0,
bNumConfigurations: 1 },
portNumbers: [ 1 ] },
Device {
busNumber: 1,
deviceAddress: 2,
deviceDescriptor:
{ bLength: 18,
bDescriptorType: 1,
bcdUSB: 512,
bDeviceClass: 9,
bDeviceSubClass: 0,
bDeviceProtocol: 1,
bMaxPacketSize0: 64,
idVendor: 32903,
idProduct: 36,
bcdDevice: 0,
iManufacturer: 0,
iProduct: 0,
iSerialNumber: 0,
bNumConfigurations: 1 },
portNumbers: [ 1 ] },
Device {
busNumber: 2,
deviceAddress: 1,
deviceDescriptor:
{ bLength: 18,
bDescriptorType: 1,
bcdUSB: 0,
bDeviceClass: 9,
bDeviceSubClass: 0,
bDeviceProtocol: 0,
bMaxPacketSize0: 0,
idVendor: 32902,
idProduct: 7213,
bcdDevice: 0,
iManufacturer: 0,
iProduct: 0,
iSerialNumber: 0,
bNumConfigurations: 1 } },
Device {
busNumber: 1,
deviceAddress: 1,
deviceDescriptor:
{ bLength: 18,
bDescriptorType: 1,
bcdUSB: 0,
bDeviceClass: 9,
bDeviceSubClass: 0,
bDeviceProtocol: 0,
bMaxPacketSize0: 0,
idVendor: 32902,
idProduct: 7206,
bcdDevice: 0,
iManufacturer: 0,
iProduct: 0,
iSerialNumber: 0,
bNumConfigurations: 1 } } ]
[ 0.220000] [00001ca0] libusb: debug [libusb_get_device_list]
Ebay USBTinyISP not found
Despite it being installed:
So my question (: did I mess something up in setting up the device? Or in my code? (: I bet I did something wrong, just no idea what.
I know yours work so something must be different
(PC = Win7, this programmer works under Arduino, the installed driver is the Adafruit libusb-win32 one so should work with node-usb)
Wait! I think I got it figured out.
Wondering if it wasnt node-usb, I tried usb-detection (https://www.npmjs.com/package/usb-detection)
It's list function revealed the secret: (wish node-usb included the text descriptions - i was checking the list looking for the PID/VID i was expecting)
...
{ locationId: 0,
vendorId: 6017,
productId: 3231,
deviceName: 'USBtiny',
manufacturer: 'Adafruit Industries',
serialNumber: '',
deviceAddress: 7 },
...
Under node-usb using VID6017 and PID3231 now finds it! Weird that windows device manager shows different values!
Oh well, found my mistake and thank goodness you changed avrgirl-usbtinyisp to have configurable VID/PID (else i'd have to ask again to add these) - I guess I can move on now! Yay!
And this might be why the windows ID doesnt work:
Windows ID is in hex. node-usb expects decimal :+1:
hi @openbuilds-engineer thanks for checking in and testing this out. Apologies for the vid and pid confusion around the format. I wrote this library a while ago and forgot how they should be specified (I think I went with the node-usb required format 🤔).
I made some additions to the documentation to clarify this for other people. Let me know if you think it was an improvement 😄
RE coffee, where do we buy you a coffee by the way? (: unless I misread the readme I dont see donation link
Thanks for the documentation update!
Sidenote, spent most of Friday hunting this issue some more. IIn the end, thus, the ebay programmers use the Adafruit pid/vid as well, so actually this was me going on a goose chace as I a) i misunderstood the pid/vid string (hex/dec) and b) i though the "hanging" i experienced was due to the PID/VID. Now that I have delibrately the wrong pid/vid I see it doesnt hang, but actually does say so in the error oops!
So i'm still stuck, unable to use this, with the script just "hanging" - I traced through it all, and its a couple levels below your code, in node-usb: https://github.com/tessel/node-usb/issues/304 so logged there to see what I am being stupid with as well (;
@openbuilds-engineer reopening this issue, as this needed to be investigated.
Love the project, can you add support for my USBTiny (Off ebay) with VID/PID above? (It works in Arduino so I suspect it just the VID/PID?)