[fpc-pascal] USB Human Interface Devices

Johann Glaser Johann.Glaser at gmx.at
Tue Aug 6 23:34:34 CEST 2019


Hi!

Am Dienstag, den 06.08.2019, 01:35 +0200 schrieb Jean SUZINEAU:
>     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.exeBus 001 Device 010:
> ID 10C4:EA60Device
> Descriptor:  bLength                18  bDescriptorType         1  bc
> dUSB               2.00  bDeviceClass            0  bDeviceSubClass
>        0  bDeviceProtocol         0  bMaxPacketSize0        64  idVen
> dor            $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    bConfig
> urationValue     1    iConfiguration          0    bmAttributes
>     $80    MaxPower              100mA    Interface
> Descriptor:      bLength                 9      bDescriptorType
>    4      bInterfaceNumber        0      bAlternateSetting       0
>    bNumEndpoints           2      bInterfaceClass       255      bInt
> erfaceSubClass      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.exeSubmitting control
> transferFinished Transfer, Data = 38, Status = 0, ActualLength =
> 18Device
> Descriptor:  bLength                18  bDescriptorType         1  bc
> dUSB               2.00  bDeviceClass            0  bDeviceSubClass
>        0  bDeviceProtocol         0  bMaxPacketSize0        64  idVen
> dor            $10C4  idProduct           $EA60  bcdDevice
>  1.00  iManufacturer           1  iProduct                2  iSerialN
> umber           3  bNumConfigurations      1Done.
> E:\03_travail\libusb\pas-libusb_test_dll\src\examples>
>
>

Thats great, it works! Then have fun with all further experiments. If
you need help, just ping me.
Bye  Hansi


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20190806/1e12f53e/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: face-smile.png
Type: image/png
Size: 871 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20190806/1e12f53e/attachment-0001.png>


More information about the fpc-pascal mailing list