`sig
val handle_error : ('a -> 'b) -> 'a -> 'b
type error =
Error_io
| Error_invalid_param
| Error_access
| Error_no_device
| Error_not_found
| Error_busy
| Error_timeout
| Error_overflow
| Error_pipe
| Error_interrupted
| Error_no_mem
| Error_not_supported
| Error_other
exception Error of USB.error * string
val error_message : USB.error -> string
type direction = In | Out
type endpoint = int
val init : unit Stdlib.Lazy.t
val set_debug : [ `error | `quiet | `verbose | `warning ] -> unit
type device
val get_device_list : unit -> USB.device list
val get_bus_number : USB.device -> int
val get_device_address : USB.device -> int
val get_max_packet_size :
device:USB.device ->
direction:USB.direction -> endpoint:USB.endpoint -> int
type handle
type interface = int
val open_device : USB.device -> USB.handle
val close : USB.handle -> unit
val open_device_with : vendor_id:int -> product_id:int -> USB.handle
val get_device : USB.handle -> USB.device
val kernel_driver_active : USB.handle -> USB.interface -> bool
val detach_kernel_driver : USB.handle -> USB.interface -> unit
val attach_kernel_driver : USB.handle -> USB.interface -> unit
val claim_interface : USB.handle -> USB.interface -> unit Lwt.t
val release_interface : USB.handle -> USB.interface -> unit Lwt.t
type configuration = int
val get_configuration : USB.handle -> USB.configuration Lwt.t
val set_configuration : USB.handle -> USB.configuration -> unit Lwt.t
val set_interface_alt_setting :
USB.handle -> USB.interface -> int -> unit Lwt.t
val clear_halt : USB.handle -> USB.endpoint -> unit Lwt.t
val reset_device : USB.handle -> unit Lwt.t
module Class :
sig
type t = int
val per_interface : USB.Class.t
val audio : USB.Class.t
val communication : USB.Class.t
val hid : USB.Class.t
val physical : USB.Class.t
val printer : USB.Class.t
val image : USB.Class.t
val mass_storage : USB.Class.t
val hub : USB.Class.t
val data : USB.Class.t
val smart_card : USB.Class.t
val content_security : USB.Class.t
val video : USB.Class.t
val personal_healthcare : USB.Class.t
val diagnostic_device : USB.Class.t
val wireless : USB.Class.t
val application : USB.Class.t
val vendor_specific : USB.Class.t
val ptp : USB.Class.t
val to_string : USB.Class.t -> string
end
type device_descriptor = {
dd_usb : int;
dd_device_class : USB.Class.t;
dd_device_sub_class : int;
dd_device_protocol : int;
dd_max_packet_size : int;
dd_vendor_id : int;
dd_product_id : int;
dd_device : int;
dd_index_manufacturer : int;
dd_index_product : int;
dd_index_serial_number : int;
dd_configurations : int;
}
val get_device_descriptor : USB.device -> USB.device_descriptor
type endpoint_descriptor = {
ed_endpoint_address : int;
ed_attributes : int;
ed_max_packet_size : int;
ed_interval : int;
ed_refresh : int;
ed_synch_address : int;
}
type interface_descriptor = {
id_interface : int;
id_alternate_setting : int;
id_interface_class : USB.Class.t;
id_interface_sub_class : int;
id_interface_protocol : int;
id_index_interface : int;
id_endpoints : USB.endpoint_descriptor array;
}
type config_descriptor = {
cd_configuration_value : int;
cd_index_configuration : int;
cd_attributes : int;
cd_max_power : int;
cd_interfaces : USB.interface_descriptor array array;
}
val get_active_config_descriptor : USB.device -> USB.config_descriptor
val get_config_descriptor : USB.device -> int -> USB.config_descriptor
val get_config_descriptor_by_value :
USB.device -> int -> USB.config_descriptor
module DT :
sig
type t = int
val device : USB.DT.t
val config : USB.DT.t
val string : USB.DT.t
val interface : USB.DT.t
val endpoint : USB.DT.t
val hid : USB.DT.t
val report : USB.DT.t
val physical : USB.DT.t
val hub : USB.DT.t
end
val get_string_descriptor :
USB.handle -> ?timeout:float -> ?lang_id:int -> index:int -> string Lwt.t
type transfer_error =
Transfer_error
| Transfer_timed_out
| Transfer_cancelled
| Transfer_stall
| Transfer_no_device
| Transfer_overflow
exception Transfer of USB.transfer_error * string
val transfer_error_message : USB.transfer_error -> string
val bulk_recv :
handle:USB.handle ->
endpoint:USB.endpoint ->
?timeout:float -> string -> int -> int -> int Lwt.t
val bulk_send :
handle:USB.handle ->
endpoint:USB.endpoint ->
?timeout:float -> string -> int -> int -> int Lwt.t
val interrupt_recv :
handle:USB.handle ->
endpoint:USB.endpoint ->
?timeout:float -> string -> int -> int -> int Lwt.t
val interrupt_send :
handle:USB.handle ->
endpoint:USB.endpoint ->
?timeout:float -> string -> int -> int -> int Lwt.t
type iso_result = Iso_ok of int | Iso_error of USB.transfer_error * string
val iso_recv :
handle:USB.handle ->
endpoint:USB.endpoint ->
?timeout:float -> string -> int -> int list -> USB.iso_result list Lwt.t
val iso_send :
handle:USB.handle ->
endpoint:USB.endpoint ->
?timeout:float -> string -> int -> int list -> USB.iso_result list Lwt.t
type recipient = Device | Interface | Endpoint | Other
type request_type = Standard | Class | Vendor | Reserved
type request = int
val control_send :
handle:USB.handle ->
endpoint:USB.endpoint ->
?timeout:float ->
?recipient:USB.recipient ->
?request_type:USB.request_type ->
request:USB.request ->
value:int -> index:int -> string -> int -> int -> int Lwt.t
val control_recv :
handle:USB.handle ->
endpoint:USB.endpoint ->
?timeout:float ->
?recipient:USB.recipient ->
?request_type:USB.request_type ->
request:USB.request ->
value:int -> index:int -> string -> int -> int -> int Lwt.t
module Request :
sig
type t = USB.request
val get_status : USB.Request.t
val clear_feature : USB.Request.t
val set_feature : USB.Request.t
val set_address : USB.Request.t
val get_descriptor : USB.Request.t
val set_descriptor : USB.Request.t
val get_configuration : USB.Request.t
val set_configuration : USB.Request.t
val get_interface : USB.Request.t
val set_interface : USB.Request.t
val synch_frame : USB.Request.t
end
end`