package usb

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
val handle_error : ('a -> 'b) -> 'a -> 'b
type error =
  1. | Error_io
  2. | Error_invalid_param
  3. | Error_access
  4. | Error_no_device
  5. | Error_not_found
  6. | Error_busy
  7. | Error_timeout
  8. | Error_overflow
  9. | Error_pipe
  10. | Error_interrupted
  11. | Error_no_mem
  12. | Error_not_supported
  13. | Error_other
exception Error of error * string
val error_message : error -> string
type direction =
  1. | In
  2. | Out
type endpoint = int
val init : unit Lazy.t
val set_debug : [ `error | `quiet | `verbose | `warning ] -> unit
type device
val get_device_list : unit -> device list
val get_bus_number : device -> int
val get_device_address : device -> int
val get_max_packet_size : device:device -> direction:direction -> endpoint:endpoint -> int
type handle
type interface = int
val open_device : device -> handle
val close : handle -> unit
val open_device_with : vendor_id:int -> product_id:int -> handle
val get_device : handle -> device
val kernel_driver_active : handle -> interface -> bool
val detach_kernel_driver : handle -> interface -> unit
val attach_kernel_driver : handle -> interface -> unit
val claim_interface : handle -> interface -> unit Lwt.t
val release_interface : handle -> interface -> unit Lwt.t
type configuration = int
val get_configuration : handle -> configuration Lwt.t
val set_configuration : handle -> configuration -> unit Lwt.t
val set_interface_alt_setting : handle -> interface -> int -> unit Lwt.t
val clear_halt : handle -> endpoint -> unit Lwt.t
val reset_device : handle -> unit Lwt.t
module Class : sig ... end
type device_descriptor = {
  1. dd_usb : int;
  2. dd_device_class : Class.t;
  3. dd_device_sub_class : int;
  4. dd_device_protocol : int;
  5. dd_max_packet_size : int;
  6. dd_vendor_id : int;
  7. dd_product_id : int;
  8. dd_device : int;
  9. dd_index_manufacturer : int;
  10. dd_index_product : int;
  11. dd_index_serial_number : int;
  12. dd_configurations : int;
}
val get_device_descriptor : device -> device_descriptor
type endpoint_descriptor = {
  1. ed_endpoint_address : int;
  2. ed_attributes : int;
  3. ed_max_packet_size : int;
  4. ed_interval : int;
  5. ed_refresh : int;
  6. ed_synch_address : int;
}
type interface_descriptor = {
  1. id_interface : int;
  2. id_alternate_setting : int;
  3. id_interface_class : Class.t;
  4. id_interface_sub_class : int;
  5. id_interface_protocol : int;
  6. id_index_interface : int;
  7. id_endpoints : endpoint_descriptor array;
}
type config_descriptor = {
  1. cd_configuration_value : int;
  2. cd_index_configuration : int;
  3. cd_attributes : int;
  4. cd_max_power : int;
  5. cd_interfaces : interface_descriptor array array;
}
val get_active_config_descriptor : device -> config_descriptor
val get_config_descriptor : device -> int -> config_descriptor
val get_config_descriptor_by_value : device -> int -> config_descriptor
module DT : sig ... end
val get_string_descriptor : handle -> ?timeout:float -> ?lang_id:int -> index:int -> string Lwt.t
type transfer_error =
  1. | Transfer_error
  2. | Transfer_timed_out
  3. | Transfer_cancelled
  4. | Transfer_stall
  5. | Transfer_no_device
  6. | Transfer_overflow
exception Transfer of transfer_error * string
val transfer_error_message : transfer_error -> string
val bulk_recv : handle:handle -> endpoint:endpoint -> ?timeout:float -> string -> int -> int -> int Lwt.t
val bulk_send : handle:handle -> endpoint:endpoint -> ?timeout:float -> string -> int -> int -> int Lwt.t
val interrupt_recv : handle:handle -> endpoint:endpoint -> ?timeout:float -> string -> int -> int -> int Lwt.t
val interrupt_send : handle:handle -> endpoint:endpoint -> ?timeout:float -> string -> int -> int -> int Lwt.t
type iso_result =
  1. | Iso_ok of int
  2. | Iso_error of transfer_error * string
val iso_recv : handle:handle -> endpoint:endpoint -> ?timeout:float -> string -> int -> int list -> iso_result list Lwt.t
val iso_send : handle:handle -> endpoint:endpoint -> ?timeout:float -> string -> int -> int list -> iso_result list Lwt.t
type recipient =
  1. | Device
  2. | Interface
  3. | Endpoint
  4. | Other
type request_type =
  1. | Standard
  2. | Class
  3. | Vendor
  4. | Reserved
type request = int
val control_send : handle:handle -> endpoint:endpoint -> ?timeout:float -> ?recipient:recipient -> ?request_type:request_type -> request:request -> value:int -> index:int -> string -> int -> int -> int Lwt.t
val control_recv : handle:handle -> endpoint:endpoint -> ?timeout:float -> ?recipient:recipient -> ?request_type:request_type -> request:request -> value:int -> index:int -> string -> int -> int -> int Lwt.t
module Request : sig ... end