Switched suitable c ints to b32
This commit is contained in:
Vendored
+13
-9
@@ -11,6 +11,7 @@ import "core:c"
|
|||||||
// available; use pkg-config or linker flags to control it externally.
|
// available; use pkg-config or linker flags to control it externally.
|
||||||
LIBUSB_SHARED :: #config(LIBUSB_SHARED, true)
|
LIBUSB_SHARED :: #config(LIBUSB_SHARED, true)
|
||||||
|
|
||||||
|
//odinfmt: disable
|
||||||
when ODIN_OS == .Windows {
|
when ODIN_OS == .Windows {
|
||||||
when ODIN_ARCH == .amd64 {
|
when ODIN_ARCH == .amd64 {
|
||||||
when LIBUSB_SHARED {
|
when LIBUSB_SHARED {
|
||||||
@@ -42,6 +43,7 @@ when ODIN_OS == .Windows {
|
|||||||
// Install via: apt install libusb-1.0-0-dev / brew install libusb / etc.
|
// Install via: apt install libusb-1.0-0-dev / brew install libusb / etc.
|
||||||
foreign import lib "system:usb-1.0"
|
foreign import lib "system:usb-1.0"
|
||||||
}
|
}
|
||||||
|
//odinfmt: enable
|
||||||
|
|
||||||
// libusb API version (1.0.30).
|
// libusb API version (1.0.30).
|
||||||
API_VERSION :: 0x0100010C
|
API_VERSION :: 0x0100010C
|
||||||
@@ -734,13 +736,13 @@ Transfer_Cb :: #type proc "c" (transfer: ^Transfer)
|
|||||||
// Log message callback. Since version 1.0.23.
|
// Log message callback. Since version 1.0.23.
|
||||||
Log_Cb :: #type proc "c" (ctx: Context, level: Log_Level, str: cstring)
|
Log_Cb :: #type proc "c" (ctx: Context, level: Log_Level, str: cstring)
|
||||||
|
|
||||||
// Hotplug event callback. Return 1 to deregister this callback.
|
// Hotplug event callback. Return true to deregister this callback.
|
||||||
Hotplug_Callback_Fn :: #type proc "c" (
|
Hotplug_Callback_Fn :: #type proc "c" (
|
||||||
ctx: Context,
|
ctx: Context,
|
||||||
device: Device,
|
device: Device,
|
||||||
event: Hotplug_Events,
|
event: Hotplug_Events,
|
||||||
user_data: rawptr,
|
user_data: rawptr,
|
||||||
) -> c.int
|
) -> b32
|
||||||
|
|
||||||
// Callback invoked when a new file descriptor should be monitored for events.
|
// Callback invoked when a new file descriptor should be monitored for events.
|
||||||
Pollfd_Added_Cb :: #type proc "c" (fd: c.int, events: c.short, user_data: rawptr)
|
Pollfd_Added_Cb :: #type proc "c" (fd: c.int, events: c.short, user_data: rawptr)
|
||||||
@@ -766,7 +768,7 @@ foreign lib {
|
|||||||
|
|
||||||
// Returns device count (positive) or a negative Error code.
|
// Returns device count (positive) or a negative Error code.
|
||||||
get_device_list :: proc(ctx: Context, list: ^[^]Device) -> int ---
|
get_device_list :: proc(ctx: Context, list: ^[^]Device) -> int ---
|
||||||
free_device_list :: proc(list: [^]Device, unref_devices: c.int) ---
|
free_device_list :: proc(list: [^]Device, unref_devices: b32) ---
|
||||||
get_bus_number :: proc(dev: Device) -> u8 ---
|
get_bus_number :: proc(dev: Device) -> u8 ---
|
||||||
get_port_number :: proc(dev: Device) -> u8 ---
|
get_port_number :: proc(dev: Device) -> u8 ---
|
||||||
// Returns number of elements filled or negative Error code.
|
// Returns number of elements filled or negative Error code.
|
||||||
@@ -800,10 +802,11 @@ foreign lib {
|
|||||||
kernel_driver_active :: proc(dev_handle: Device_Handle, interface_number: c.int) -> c.int ---
|
kernel_driver_active :: proc(dev_handle: Device_Handle, interface_number: c.int) -> c.int ---
|
||||||
detach_kernel_driver :: proc(dev_handle: Device_Handle, interface_number: c.int) -> Error ---
|
detach_kernel_driver :: proc(dev_handle: Device_Handle, interface_number: c.int) -> Error ---
|
||||||
attach_kernel_driver :: proc(dev_handle: Device_Handle, interface_number: c.int) -> Error ---
|
attach_kernel_driver :: proc(dev_handle: Device_Handle, interface_number: c.int) -> Error ---
|
||||||
set_auto_detach_kernel_driver :: proc(dev_handle: Device_Handle, enable: c.int) -> Error ---
|
set_auto_detach_kernel_driver :: proc(dev_handle: Device_Handle, enable: b32) -> Error ---
|
||||||
|
|
||||||
// ---- Miscellaneous ----
|
// ---- Miscellaneous ----
|
||||||
|
|
||||||
|
// Returns nonzero if the capability is supported, 0 otherwise.
|
||||||
has_capability :: proc(capability: Capability) -> c.int ---
|
has_capability :: proc(capability: Capability) -> c.int ---
|
||||||
error_name :: proc(errcode: Error) -> cstring ---
|
error_name :: proc(errcode: Error) -> cstring ---
|
||||||
get_version :: proc() -> ^Version ---
|
get_version :: proc() -> ^Version ---
|
||||||
@@ -847,7 +850,7 @@ foreign lib {
|
|||||||
|
|
||||||
// Returns 1 if supported, 0 if not, or negative Error code.
|
// Returns 1 if supported, 0 if not, or negative Error code.
|
||||||
endpoint_supports_raw_io :: proc(dev_handle: Device_Handle, endpoint: u8) -> c.int ---
|
endpoint_supports_raw_io :: proc(dev_handle: Device_Handle, endpoint: u8) -> c.int ---
|
||||||
endpoint_set_raw_io :: proc(dev_handle: Device_Handle, endpoint: u8, enable: c.int) -> c.int ---
|
endpoint_set_raw_io :: proc(dev_handle: Device_Handle, endpoint: u8, enable: b32) -> c.int ---
|
||||||
get_max_raw_io_transfer_size :: proc(dev_handle: Device_Handle, endpoint: u8) -> c.int ---
|
get_max_raw_io_transfer_size :: proc(dev_handle: Device_Handle, endpoint: u8) -> c.int ---
|
||||||
|
|
||||||
// ---- Device hotplug event notification ----
|
// ---- Device hotplug event notification ----
|
||||||
@@ -872,19 +875,20 @@ foreign lib {
|
|||||||
|
|
||||||
// ---- Polling and timing ----
|
// ---- Polling and timing ----
|
||||||
|
|
||||||
|
// Returns 0 if the lock was obtained, 1 if it was not.
|
||||||
try_lock_events :: proc(ctx: Context) -> c.int ---
|
try_lock_events :: proc(ctx: Context) -> c.int ---
|
||||||
lock_events :: proc(ctx: Context) ---
|
lock_events :: proc(ctx: Context) ---
|
||||||
unlock_events :: proc(ctx: Context) ---
|
unlock_events :: proc(ctx: Context) ---
|
||||||
event_handling_ok :: proc(ctx: Context) -> c.int ---
|
event_handling_ok :: proc(ctx: Context) -> b32 ---
|
||||||
event_handler_active :: proc(ctx: Context) -> c.int ---
|
event_handler_active :: proc(ctx: Context) -> b32 ---
|
||||||
interrupt_event_handler :: proc(ctx: Context) ---
|
interrupt_event_handler :: proc(ctx: Context) ---
|
||||||
lock_event_waiters :: proc(ctx: Context) ---
|
lock_event_waiters :: proc(ctx: Context) ---
|
||||||
unlock_event_waiters :: proc(ctx: Context) ---
|
unlock_event_waiters :: proc(ctx: Context) ---
|
||||||
wait_for_event :: proc(ctx: Context, tv: ^Timeval) -> c.int ---
|
wait_for_event :: proc(ctx: Context, tv: ^Timeval) -> c.int ---
|
||||||
handle_events :: proc(ctx: Context) -> Error ---
|
handle_events :: proc(ctx: Context) -> Error ---
|
||||||
handle_events_timeout :: proc(ctx: Context, tv: ^Timeval) -> Error ---
|
handle_events_timeout :: proc(ctx: Context, tv: ^Timeval) -> Error ---
|
||||||
handle_events_timeout_completed :: proc(ctx: Context, tv: ^Timeval, completed: ^c.int) -> Error ---
|
handle_events_timeout_completed :: proc(ctx: Context, tv: ^Timeval, completed: ^b32) -> Error ---
|
||||||
handle_events_completed :: proc(ctx: Context, completed: ^c.int) -> Error ---
|
handle_events_completed :: proc(ctx: Context, completed: ^b32) -> Error ---
|
||||||
handle_events_locked :: proc(ctx: Context, tv: ^Timeval) -> Error ---
|
handle_events_locked :: proc(ctx: Context, tv: ^Timeval) -> Error ---
|
||||||
pollfds_handle_timeouts :: proc(ctx: Context) -> c.int ---
|
pollfds_handle_timeouts :: proc(ctx: Context) -> c.int ---
|
||||||
// Returns 0 if no timeout, 1 if a timeout was returned, or negative Error code.
|
// Returns 0 if no timeout, 1 if a timeout was returned, or negative Error code.
|
||||||
|
|||||||
Reference in New Issue
Block a user