diff --git a/libusb.odin b/libusb.odin index 6c8761c..d64ac53 100644 --- a/libusb.odin +++ b/libusb.odin @@ -2,6 +2,7 @@ package libusb import "core:c" import "core:fmt" +//TODO: Make multiplatform //TODO: Switch to sys/posix when linux support is finished import "posix" @@ -1065,11 +1066,13 @@ Hotplug_Event :: enum c.int { * Since version 1.0.16, \ref LIBUSB_API_VERSION >= 0x01000102 * * Hotplug flags */ -Hotplug_Flag :: enum c.int { +Hotplug_Flag_Bits :: enum c.int { /** Arm the callback and fire it for all matching currently attached devices. */ - ENUMERATE = 1, + ENUMERATE = 0, } +Hotplug_Flag :: bit_set[Hotplug_Flag_Bits; c.int] + /** \ingroup libusb_hotplug * Convenience macro when not using any flags */ HOTPLUG_NO_FLAGS :: 0 @@ -1081,7 +1084,7 @@ Hotplug_Callback_Fn :: #type proc "c" ( ctx: Context, device: ^Device, event: Hotplug_Event, - user_date: rawptr, + user_data: rawptr, ) -> c.int Callback_Handle :: distinct c.int @@ -1117,8 +1120,8 @@ foreign lib { exit :: proc(ctx: Context) --- //----- Device handling and enumeration ---------------------------------- - get_device_list :: proc(ctx: Context, list: ^^[^]Device) -> int --- - free_device_list :: proc(device: ^[^]Device, unref_devices: c.int) --- + get_device_list :: proc(ctx: Context, list: ^[^][^]Device) -> int --- + free_device_list :: proc(device: [^][^]Device, unref_devices: c.int) --- get_bus_number :: proc(dev: ^Device) -> u8 --- get_port_number :: proc(dev: ^Device) -> u8 --- get_port_numbers :: proc(dev: ^Device, port_numbers: [^]u8, port_numbers_len: c.int) -> Error --- @@ -1172,12 +1175,12 @@ foreign lib { get_platform_descriptor :: proc(ctx: Context, dev_cap: ^Bos_Dev_Capability_Descriptor, platform_descriptor: ^^Platform_Descriptor) -> Error --- free_platform_descriptor :: proc(platform_descriptor: ^Platform_Descriptor) --- get_string_descriptor_ascii :: proc(dev_handle: ^Device_Handle, desc_index: u8, data: cstring, length: c.int) -> c.int --- - get_interface_association_descriptors :: proc(dev: ^Device, config_index: u8, iad_array: ^^Interface_Association_Descriptor_Array) -> Error --- - get_active_interface_association_descriptors :: proc(dev: ^Device, iad_array: ^^Interface_Association_Descriptor_Array) -> Error --- + get_interface_association_descriptors :: proc(dev: ^Device, config_index: u8, iad_array: [^][^]Interface_Association_Descriptor_Array) -> Error --- + get_active_interface_association_descriptors :: proc(dev: ^Device, iad_array: [^][^]Interface_Association_Descriptor_Array) -> Error --- free_interface_association_descriptors :: proc(iad_array: ^Interface_Association_Descriptor_Array) -> Error --- //----- Device hotplug event notification ---------------------------------- - hotplug_register_callback :: proc(ctx: Context, events: c.int, flags: c.int, vendor_id: c.int, product_id: c.int, dev_class: c.int, cb_fn: Hotplug_Callback_Fn, callback_handle: Callback_Handle) -> Error --- + hotplug_register_callback :: proc(ctx: Context, events: c.int, flags: Hotplug_Flag, vendor_id: c.int, product_id: c.int, dev_class: c.int, cb_fn: Hotplug_Callback_Fn, user_data: rawptr, callback_handle: ^Callback_Handle) -> Error --- hotplug_deregister_callback :: proc(ctx: Context, hotplug_callback_handle: Callback_Handle) --- hotplug_get_user_data :: proc(ctx: Context, hotplug_callback_handle: Callback_Handle) -> rawptr ---