hidapi
hid-device-info
hid-device?
hid-init
hid-exit
hid-enumerate
hid-open
hid-open-path
hid-set-nonblocking
hid-close
hid-write
hid-write-full
hid-read
hid-read-bytes
hid-read-timeout
hid-read-bytes/  timeout
hid-get-feature-report
hid-send-feature-report
hid-get-manufacturer-string
hid-get-product-string
hid-get-serial-number-string
hid-get-indexed-string
6.12

hidapi

Jiten K. Pathy

 (require hidapi) package: hidapi

This package provides bindings to hidapi library. The library name is searched in the order:
"libhidapi" "libhidapi-libusb" "libhidapi-hidraw"

struct

(struct hid-device-info (path
    vendor-id
    product-id
    serial-number
    release-number
    manufacturer-string
    product-string
    usage-page
    usage
    interface-number))
  path : path?
  vendor-id : integer?
  product-id : integer?
  serial-number : string?
  release-number : integer?
  manufacturer-string : string?
  product-string : string?
  usage-page : integer?
  usage : integer?
  interface-number : integer?
A racket structure corresponding to foreign structure hid_device_info.

procedure

(hid-device? d)  boolean?

  d : any/c
Returns #t if it is a hid_device, #f otherwise.

procedure

(hid-init)  void?

Binding to hid_init. Might raise exception exn:fail.

procedure

(hid-exit)  void?

Binding to hid_exit. Might raise exception exn:fail.

procedure

(hid-enumerate [#:vendor-id v    
  #:product-id p])  (listof hid-device-info?)
  v : integer? = 0
  p : integer? = 0
High-level safe binding to hid_enumerate. The foreign allocated data is free’d with hid_free_enumeration.

procedure

(hid-open #:vendor-id v    
  #:product-id p    
  #:serial-number s)  (or/c hid-device? #f)
  v : integer?
  p : integer?
  s : string?
Binding to hid_open.

procedure

(hid-open-path p)  (or/c hid-device? #f)

  p : path?
Binding to hid_open_path.

procedure

(hid-set-nonblocking d b)  void?

  d : hid-device?
  b : boolean?
Binding to hid_set_nonblocking. Might raise exception exn:fail.

procedure

(hid-close d)  void?

  d : hid-device?
Binding to hid_close.

procedure

(hid-write d bstr size)  integer?

  d : hid-device?
  bstr : bytes?
  size : integer?
Binding to hid_write. Might raise exception exn:fail.

procedure

(hid-write-full d bstr)  integer?

  d : hid-device?
  bstr : bytes?
Same as (hid-write bstr (bytes-length bstr)).

procedure

(hid-read d bstr size)  integer?

  d : hid-device?
  bstr : bytes?
  size : integer?
Binding to hid_read. Might raise exception exn:fail.

procedure

(hid-read-bytes d size)  bytes?

  d : hid-device?
  size : integer?
Same as (hid-read d (make-bytes size) size), returns the created bytestring.

procedure

(hid-read-timeout d bstr size millis)  integer?

  d : hid-device?
  bstr : bytes?
  size : integer?
  millis : integer?
Binding to hid_read_timeout. Might raise exception exn:fail.

procedure

(hid-read-bytes/timeout d size millis)  bytes?

  d : hid-device?
  size : integer?
  millis : integer?
Binding to (hid-read-timeout d (make-bytes size) size millis), returns the created bytestring.

procedure

(hid-get-feature-report d bstr size)  integer?

  d : hid-device?
  bstr : bytes?
  size : integer?
Binding to hid_get_feature_report. Might raise exception exn:fail.

procedure

(hid-send-feature-report d bstr size)  integer?

  d : hid-device?
  bstr : bytes?
  size : integer?
Binding to hid_send_feature_report. Might raise exception exn:fail.

procedure

(hid-get-manufacturer-string d size)  string?

  d : hid-device?
  size : integer?
Binding to hid_get_manufacturer_string. Might raise exception exn:fail.

procedure

(hid-get-product-string d size)  string?

  d : hid-device?
  size : integer?
Binding to hid_get_product_string. Might raise exception exn:fail.

procedure

(hid-get-serial-number-string d size)  string?

  d : hid-device?
  size : integer?
Binding to hid_get_serial_number_string. Might raise exception exn:fail.

procedure

(hid-get-indexed-string d idx size)  string?

  d : hid-device?
  idx : integer?
  size : integer?
Binding to hid_get_indexed_string. Might raise exception exn:fail.