usb icon indicating copy to clipboard operation
usb copied to clipboard

Printer Error:failed to get device 3 config 0: libusb: not found [code -5]

Open Faris84 opened this issue 4 years ago • 4 comments

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 avatar Sep 25 '21 21:09 Faris84

@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.

gaurav-gogia avatar Dec 29 '21 07:12 gaurav-gogia

I have the same error!

Seems really to be a problem in general.

kernelPanic0x avatar Aug 28 '22 15:08 kernelPanic0x

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

mattscamp avatar Aug 31 '22 21:08 mattscamp

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?

kernelPanic0x avatar Sep 02 '22 20:09 kernelPanic0x