在java中是否有获取设备名称的函数?

在java中是否有获取设备名称的函数?,java,usb,device,Java,Usb,Device,在这段代码中,我只能得到总线号、地址、idVendor和idProduct。我可以使用此方法获取设备名称和产品描述吗? 我不知道为什么它显示了更多的设备,就像没有连接的设备一样,但它显示了三个设备 public void ListUsb() throws IOException { DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:m

在这段代码中,我只能得到总线号、地址、idVendor和idProduct。我可以使用此方法获取设备名称和产品描述吗? 我不知道为什么它显示了更多的设备,就像没有连接的设备一样,但它显示了三个设备

public void ListUsb() throws IOException
               {
                    DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss");  
                   Context context = new Context();

        int result = LibUsb.init(context);
     
        if (result < 0)
        {
            throw new LibUsbException("Unable to initialize libusb", result);
        }

        DeviceList list = new DeviceList();

        result = LibUsb.getDeviceList(context, list);

    
        if (result < 0)
        {
            throw new LibUsbException("Unable to get device list", result);
        }

        try
        {
          
            for (Device device: list)
            {
                int address = LibUsb.getDeviceAddress(device);

                int busNumber = LibUsb.getBusNumber(device);
                DeviceDescriptor descriptor = new DeviceDescriptor();
                result = LibUsb.getDeviceDescriptor(device, descriptor);
                if (result < 0)
                {
                    throw new LibUsbException(
                        "Unable to read device descriptor", result);
                }
         System.out.format("Bus %03d, Device %03d: Vendor %04x, Product %04x%n ",busNumber, address, descriptor.idVendor(),descriptor.idProduct());
            
                
    }
              
      
        }
        finally
        {
   
            LibUsb.freeDeviceList(list, true);
        }

        LibUsb.exit(context);
    }
public void listub()引发IOException
{
DateTimeFormatter dtf=模式的DateTimeFormatter.of(“yyyy/MM/dd HH:MM:ss”);
上下文=新上下文();
int result=LibUsb.init(上下文);
如果(结果<0)
{
抛出新的libusbeexception(“无法初始化libusb”,结果);
}
设备列表=新设备列表();
结果=LibUsb.getDeviceList(上下文,列表);
如果(结果<0)
{
抛出新的LibUsbException(“无法获取设备列表”,结果);
}
尝试
{
用于(设备:列表)
{
int address=LibUsb.getDeviceAddress(设备);
int-busNumber=LibUsb.getBusNumber(设备);
DeviceDescriptor描述符=新的DeviceDescriptor();
结果=LibUsb.getDeviceDescriptor(设备,描述符);
如果(结果<0)
{
抛出新libusbeexception(
“无法读取设备描述符”,结果);
}
System.out.format(“总线%03d,设备%03d:供应商%04x,产品%04x%n”,总线号,地址,描述符.idVendor(),描述符.idProduct());
}
}
最后
{
LibUsb.freeDeviceList(list,true);
}
LibUsb.exit(上下文);
}