Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Faris84 opened this issue Sep 25, 2021 · 4 comments

Comments

@Faris84
Copy link

Faris84 commented Sep 25, 2021

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.

@gaurav-gogia
Copy link

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

@kernelPanic0x
Copy link

I have the same error!

Seems really to be a problem in general.

@mattscamp
Copy link

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

@kernelPanic0x
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants