Printer Error:failed to get device 3 config 0: libusb: not found [code -5]
I am sorry that I got this error when I used this lib to do USB printer job in my Windows10.
below is my code, and error occurred in usb.Enumerate(0, 0) to get all devices.
func findPrinters() ([]Device, error) {
logrus.Infof("is this os supported: %v", usb.Supported())
deviceInfos, err := usb.Enumerate(0, 0)
if err != nil {
return nil, err
}
printers := []Device{}
for _, info := range deviceInfos {
dev := WindowsDevice{
deviceInfo: info,
}
printers = append(printers, &dev)
logrus.Infof("find usb driver vid :%v, pid: %v", dev.GetVid(), dev.GetPid())
}
return printers, nil
}
I am not sure what it is meaning about 'libusb'. how should I install it?
Thanks.
@Faris84
As far as I understand this library. It's supposed to come bundled with libusb so that it can be used as an alternative to google's gousb library.
However, when I tested it on my machine, I found the same error.
Maybe the author can provide more details around it.
I have the same error!
Seems really to be a problem in general.
This error comes from libusb_get_config_descriptor and may be a bit misleading for you. This is not saying "libusb was not found", it is saying "the error from libusb is 'not found' (LIBUSB_ERROR_NOT_FOUND)".
Is the device on the root hub? I think this is a known issue and bNumConfigurations should be 0 in that case.
I am not sure this lib is still maintained, I based my lib on it's great foundation though if you are looking for something that is currently in active development: https://github.com/mattscamp/zerousb
Thank you havn't seen this project before. But with no luck. Same problem. I get about three devices listed in the slice when i debug the example code but then the same error message. Is there anything I can do about this? Is there a different version of libusb available where this works?