Skip to content
mcuee edited this page Jul 20, 2021 · 14 revisions

Welcome to the libusbk wiki!

libusbk document: http://libusbk.sourceforge.net/UsbK3/index.html

Table of Contents

What is it?

libusbK is a complete driver/library solution for vendor class usb device interfaces. If you are a usb developers or usb device manufacturer seeking a driver solution for a new USB widget then libusbK could be for you.

libusbK encompasses a 100% WinUSB compatible api/funtion set. All WinUSB power/pipe polices are fully supported by the libusbK driver. In Addition, libusbK has full support for isochronous endpoints and an extensive set of additional modules to simplify development.

Attention

libusbK is not an end-user component, i.e., If your googling for a usb driver because windows can't seem to find one, this is not the solution.

Licensing

LibusbK is dual license under GPL and modified BSD. For redistribution purposes, libusbK can be licensed under either agreement. See the license folder which accompanies each libusbK package for license details.

Bindings for other languages

The main libusbK library is written in standard C, but official bindings for the libusbK standard C library are provided for the folllowing languages:

How to build libusbk

Recommended tools: VS2017 or VS2019 or later WDK 7.1 (7600.16385.1), https://www.microsoft.com/en-us/download/details.aspx?id=11800

Where is DOSCMD? https://github.com/mcuee/libusbk/issues/23

Examples running log

1) Kbench
.\kBench\x64\Release\kBench.exe vid=0x04d8 pid=0xfa2e intf=0 altf=0
device-count=1
opened Benchmark Device (USB\VID_04D8&PID_FA2E\LUSBW1)..
Loop Test Information
        Driver          : libusbK
        Vid / Pid       : 04D8h / FA2Eh
        DevicePath      : \\?\usb#vid_04d8&pid_fa2e#lusbw1#{786ba56b-7e27-4ee7-b085-3c0a23560f4d}
        Device Speed    : Low/Full
        Interface #     : 00h
        Alt Interface # : 00h
        Num Endpoints   : 2
        Priority        : 0
        Read Size       : 4096
        Write Size      : 4096
        Buffer Count    : 1
        Display Refresh : 1000 (ms)
        Transfer Timeout: 5000 (ms)
        Retry Count     : 0
        Verify Data     : Off

Bulk Read (Ep81h) max packet size: 32
Bulk Write (Ep01h) max packet size: 32

While the test is running:
Press 'Q' to quit
Press 'T' for test details
Press 'I' for status information
Press 'R' to reset averages

Press 'Q' to exit, any other key to begin..
Avg. Bytes/s: 300860.44 Transfers: 70 Bytes/s: 300860.44
Avg. Bytes/s: 299555.10 Transfers: 144 Bytes/s: 298330.71
Avg. Bytes/s: 299138.36 Transfers: 218 Bytes/s: 298330.71
Avg. Bytes/s: 299008.00 Transfers: 292 Bytes/s: 298624.63
Avg. Bytes/s: 298870.81 Transfers: 366 Bytes/s: 298330.71
stopped Ep81h thread.   ExitCode=0
stopped Ep01h thread.   ExitCode=0
Loop Test Information
        Driver          : libusbK
        Vid / Pid       : 04D8h / FA2Eh
        DevicePath      : \\?\usb#vid_04d8&pid_fa2e#lusbw1#{786ba56b-7e27-4ee7-b085-3c0a23560f4d}
        Device Speed    : Low/Full
        Interface #     : 00h
        Alt Interface # : 00h
        Num Endpoints   : 2
        Priority        : 0
        Read Size       : 4096
        Write Size      : 4096
        Buffer Count    : 1
        Display Refresh : 1000 (ms)
        Transfer Timeout: 5000 (ms)
        Retry Count     : 0
        Verify Data     : Off

Bulk Read (Ep81h) max packet size: 32
        Total Bytes     : 1503232
        Total Transfers : 367
        Avg. Bytes/sec  : 298793.88
        Elapsed Time    : 5.03 seconds

Bulk Write (Ep01h) max packet size: 32
        Total Bytes     : 1503232
        Total Transfers : 367
        Avg. Bytes/sec  : 298793.88
        Elapsed Time    : 5.03 seconds

Press any key to exit..

2. Klist
.\Release\kList\x64\kList.exe

Loading USB ID's maintained by Stephen J. Gowdy <[email protected]>..

 1. Benchmark Device (Microchip Technology, Inc.) [Connected]
    Service              : libusbK
    ClassGUID            : {ECFB0CFD-74C4-4F52-BBF7-343461CD72AC}
    DeviceID             : USB\VID_04D8&PID_FA2E\LUSBW1
    DeviceInterfaceGUID  : {786BA56B-7E27-4EE7-B085-3C0A23560F4D}
    SymbolicLink         : \\?\usb#vid_04d8&pid_fa2e#lusbw1#{786ba56b-7e27-4ee7-b085-3c0a23560f4d}
    DevicePath           : \\?\usb#vid_04d8&pid_fa2e#lusbw1#{786ba56b-7e27-4ee7-b085-3c0a23560f4d}
    SerialNumber         : LUSBW1
    BusNumber            : 0
    DeviceAddress        : 1

Select device (1-1) :1

Loading driver api..
Getting descriptors..

-Device:
  bLength             :18
  bDescriptorType     :0x01
  bcdUSB              :0x0200
  bDeviceClass        :0x00 (Defined at Interface level)
  bDeviceSubClass     :0x00
  bDeviceProtocol     :0x00
  bMaxPacketSize0     :8
  idVendor            :0x04D8 (Microchip Technology, Inc.)
  idProduct           :0xFA2E
  bcdDevice           :0x0001
  iManufacturer       :1 (Travis Robinson)
  iProduct            :2 (Benchmark Device)
  iSerialNumber       :3 (LUSBW1)
  bNumConfigurations  :1
!End Device
-Configuration:
  bLength             :9
  bDescriptorType     :0x02
  wTotalLength        :32
  bNumInterfaces      :1
  bConfigurationValue :0x01
  iConfiguration      :0
  bmAttributes        :0xC0
  MaxPower            :50 (100ma)
 -Interface:
    bLength             :9
    bDescriptorType     :0x04
    bInterfaceNumber    :0x00
    bAlternateSetting   :0x00
    bNumEndpoints       :2
    bInterfaceClass     :0x00 (Defined at Interface level)
    bInterfaceSubClass  :0x00
    bInterfaceProtocol  :0x00
    iInterface          :0
   -Endpoint:
      bLength             :7
      bDescriptorType     :0x05
      bEndpointAddress    :0x01
      bmAttributes        :0x02 (Bulk)
      wMaxPacketSize      :32
      bInterval           :0x00
   !End Endpoint
   -Endpoint:
      bLength             :7
      bDescriptorType     :0x05
      bEndpointAddress    :0x81
      bmAttributes        :0x02 (Bulk)
      wMaxPacketSize      :32
      bInterval           :0x00
   !End Endpoint
 !End Interface
!End Configuration

Another example for a device with isoc loopback.


C:\libusbK-dev-kit> .\kBench.exe list intf=1
device-count=1
1. Dual Benchmark Device (USB\VID_04D8&PID_FA2E\LUSBW2) [libusbK]
Select device (1-1) :1

opened Dual Benchmark Device (USB\VID_04D8&PID_FA2E\LUSBW2)..
Loop Test Information
        Driver          : libusbK
        Vid / Pid       : 04D8h / FA2Eh
        DevicePath      : \\?\usb#vid_04d8&pid_fa2e#lusbw2#{00408134-c1fc-c7f4-3c84-6390e2cc1bfc}
        Device Speed    : Low/Full
        Interface #     : 01h
        Alt Interface # : 00h
        Num Endpoints   : 2
        Priority        : 0
        Read Size       : 4096
        Write Size      : 4096
        Buffer Count    : 2
        Display Refresh : 1000 (ms)
        Transfer Timeout: 5000 (ms)
        Retry Count     : 0
        Verify Data     : Off

Isochronous Read (Ep82h) max packet size: 64
Isochronous Write (Ep02h) max packet size: 64

While the test is running:
Press 'Q' to quit
Press 'T' for test details
Press 'I' for status information
Press 'R' to reset averages

Press 'Q' to exit, any other key to begin..
Avg. Bytes/s: 64167.10 Transfers: 12 Bytes/s: 64167.10
Avg. Bytes/s: 63821.93 Transfers: 28 Bytes/s: 63565.47
Avg. Bytes/s: 64068.25 Transfers: 44 Bytes/s: 64503.94
Avg. Bytes/s: 63915.37 Transfers: 59 Bytes/s: 63471.07
Avg. Bytes/s: 64040.03 Transfers: 75 Bytes/s: 64503.94
Avg. Bytes/s: 63956.07 Transfers: 91 Bytes/s: 63565.47
Avg. Bytes/s: 64037.41 Transfers: 107 Bytes/s: 64503.94
Avg. Bytes/s: 63959.04 Transfers: 122 Bytes/s: 63405.57
Avg. Bytes/s: 64029.00 Transfers: 138 Bytes/s: 64567.49
Avg. Bytes/s: 63980.53 Transfers: 154 Bytes/s: 63565.47
Avg. Bytes/s: 64029.43 Transfers: 170 Bytes/s: 64503.94
Avg. Bytes/s: 63978.39 Transfers: 185 Bytes/s: 63405.57
Avg. Bytes/s: 64024.89 Transfers: 201 Bytes/s: 64567.49
Avg. Bytes/s: 63986.18 Transfers: 217 Bytes/s: 63503.88
stopped Ep82h thread.   ExitCode=0
stopped Ep02h thread.   ExitCode=0
Loop Test Information
        Driver          : libusbK
        Vid / Pid       : 04D8h / FA2Eh
        DevicePath      : \\?\usb#vid_04d8&pid_fa2e#lusbw2#{00408134-c1fc-c7f4-3c84-6390e2cc1bfc}
        Device Speed    : Low/Full
        Interface #     : 01h
        Alt Interface # : 00h
        Num Endpoints   : 2
        Priority        : 0
        Read Size       : 4096
        Write Size      : 4096
        Buffer Count    : 2
        Display Refresh : 1000 (ms)
        Transfer Timeout: 5000 (ms)
        Retry Count     : 0
        Verify Data     : Off

Isochronous Read (Ep82h) max packet size: 64
        Total Bytes     : 888832
        Total Transfers : 217
        Avg. Bytes/sec  : 63986.18
        Elapsed Time    : 13.89 seconds

Isochronous Write (Ep02h) max packet size: 64
        Total Bytes     : 888832
        Total Transfers : 217
        Avg. Bytes/sec  : 63986.18
        Elapsed Time    : 13.89 seconds

Press any key to exit..
Clone this wiki locally