xhid_open   xtlang


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/examples/contrib/hid.xtm

Implementation

;; in's are 0x80
;; out's are 0x90
(bind-func xhid_open
  (lambda (vendor_id:i64 product_id:i64 interface:i32)
    (let ((stdout (fdopen 0 "w"))
          (stderr (fdopen 1 "w"))
          (hid:HIDInterface* null)
          (ret:hid_return 0)
          ;; (vendor_id #x046d)
          ;; (product_id #xc408)
          (iface_num interface)
          (matcher (HIDInterfaceMatcher (convert vendor_id)
                                        (convert product_id)
                                        null null 0)))
      (hid_set_debug (convert (bor #x1 #x2)))
      (hid_set_debug_stream stderr)
      (println "vendor id:" vendor_id "product id:" product_id)
      (set! ret (hid_init))
      (if (<> ret 0) (printf "%d,%s\n" ret (hid_strerror ret)))
      (set! hid (hid_new_HIDInterface))
      (printf "HID: %p\n" hid)
      (set! ret (hid_force_open hid iface_num matcher 3))
      (if (<> ret 0) (printf "%d,%s\n" ret (hid_strerror ret)))
      (set! ret (hid_write_identification stdout hid))
      (if (<> ret 0) (printf "%s\n" (hid_strerror ret)))
      (set! ret (hid_dump_tree stdout hid))
      (if (<> ret 0) (printf "%s\n" (hid_strerror ret)))
      hid)))


Back to Index

Similar Entries

  • fits-open-file    xtlang
  • fits-open-file    xtlang
  • gui_set_monokai_opensans_theme    xtlang
  • nvg_load_opensans_fonts    xtlang
  • ocv_isopen    xtlang
  • ocv_isopen    xtlang
  • ocv_scheme_isopen_object    xtlang
  • opengl-loop    scheme
  • opengl-loop    scheme
  • opengl-loop    scheme
  • opengl-loop    scheme
  • opengl-test    scheme
  • opengl-test    scheme
  • opengl-test    scheme
  • opengl-test    xtlang
  • sys_file_open    xtlang
  • sys_file_open_stderr    xtlang
  • sys_file_open_stdin    xtlang
  • sys_file_open_stdout    xtlang
  • xhid_close    xtlang
  • xhid_dump    xtlang
  • xhid_listener    scheme
  • xhid_read    xtlang