Hello
I haven't had time yet to read everything but I join below a few more tests.
Le 05/08/2019 à 21:38, Johann Glaser a écrit :
Yay! That looks great!

As a next step you can try test2controlsync.pas which uses control transfers to query the device descriptors. Just change the constants DevVID and DevPID at the top to the values of a device connected to your PC. I'd recommend to use a device you don't depend on during testing, i.e., don't use your primary keyboard and mouse. :-) There shouldn't be a problem, but better safe than sorry. And I hope that Windows doesn't cross your plans and already has allocated that device to a certain driver.

You can also try test3controlasync.pas, which does a very similar test, just using the asynchronous interface to libusb (and it is less verbose and estensive).

I tested successfully test2controlsync and test3controlasync on Windows 10 and Ubuntu 19.04 with a Seeeduino lotus (recognized as manufacturer Silicon Labs, Product CP2102N USB to UART Bridge Controller).

I've zipped the code in a new "convenience release" at :

https://github.com/jsuzineau/pascal_o_r_mapping/releases/tag/pas-libusb_convenience_release_2

This is the output on Windows:

E:\03_travail\libusb\pas-libusb_test_dll\src\examples>test2controlsync.exe
Bus 001 Device 010: ID 10C4:EA60
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        64
  idVendor            $10C4
  idProduct           $EA60
  bcdDevice            1.00
  iManufacturer           1 Silicon Labs
  iProduct                2 CP2102N USB to UART Bridge Controller
  iSerialNumber           3 0001
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           32
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes          $80
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255
      bInterfaceSubClass      0
      bInterfaceProtocol      0
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress      $02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize      $0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress      $82  EP 2 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize      $0040  1x 64 bytes
        bInterval               0

E:\03_travail\libusb\pas-libusb_test_dll\src\examples>test3controlasync.exe
Submitting control transfer
Finished Transfer, Data = "" Status = 0, ActualLength = 18
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        64
  idVendor            $10C4
  idProduct           $EA60
  bcdDevice            1.00
  iManufacturer           1
  iProduct                2
  iSerialNumber           3
  bNumConfigurations      1
Done.

E:\03_travail\libusb\pas-libusb_test_dll\src\examples>
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to