J'éssaye de faire une écriture vers un port usb en java avec l'API libusb.
Je peux lister les ports usb et retourner leurs IDs (ID Vendor/Product), mais je ne peux écrire dans aucun des ces ports. voici mon érreur + code:

Exception in thread "main" org.usb4java.LibUsbException: USB error 12: Unable to open USB device: Operation not supported or unimplemented on this platform

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
 
public static void main(String[] args) {
    // TODO code application logic here
    Context context = new Context();
    int result = LibUsb.init(context);
    if (result != LibUsb.SUCCESS) throw new LibUsbException("Unable to initialize libusb.", result);
    // ----
    int idVendeur = 0x8086;
    int idProduit = 0x27c9;
    USBWritting.synchronizedSendData1();
    // ----
    LibUsb.exit(context);
}
 
 public static void synchronizedSendData1(){
    DeviceList list = new DeviceList();
    int result = LibUsb.getDeviceList(null, list);
    if (result < 0) throw new LibUsbException("Unable to get device list", result);
 
    DeviceHandle handle = new DeviceHandle();
    Device device = list.get(0);
    result = LibUsb.open(device, handle);
    if (result != LibUsb.SUCCESS) throw new LibUsbException("Unable to open USB device", result);
 
    try{
        ByteBuffer buffer = ByteBuffer.allocateDirect(8);
        buffer.put(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 });
        int transfered = LibUsb.controlTransfer(handle, 
            (byte) (LibUsb.REQUEST_TYPE_CLASS | LibUsb.RECIPIENT_INTERFACE),
            (byte) 0x09, (short) 2, (short) 1, buffer, 5000);
        if (transfered < 0) throw new LibUsbException("Control transfer failed", transfered);
        System.out.println(transfered + " bytes sent");
    }
    finally{
        LibUsb.close(handle);
        LibUsb.freeDeviceList(list, true);
Au pires des cas si vous avez des APIs qui fonctionnent je suis preneur.