libusb icon indicating copy to clipboard operation
libusb copied to clipboard

incorrect class name

Open zakaria-chahboun opened this issue 3 years ago • 0 comments

Hi guys! I want to get a list of usb devices, Then catch my usb printer by it class So i did this

package main

import (
	"fmt"

	"github.com/gotmc/libusb/v2"
)

func main(){
 
 	c, err := libusb.NewContext();
 	if err != nil {
 		panic(err)
 	}
 	
 	list, _:= c.DeviceList();

 	for _, device := range list {
 		d,_ := device.DeviceDescriptor()
 		fmt.Println(d.DeviceClass)
 	}
    
}

output:

Hub class.
Hub class.
Wireless class.
Each interface specifies its own class information and all interfaces operate independently.

its gives me Each interface specifies its own class information and all interfaces operate independently. instead of "printer" class!

in terminal i get:

❯ lsusb --verbose | grep "Printer"
  iManufacturer           1 Printer-58
      bInterfaceClass         7 Printer
      bInterfaceSubClass      1 Printer

Why? and Thanks!

zakaria-chahboun avatar Jul 03 '22 01:07 zakaria-chahboun