Go to the documentation of this file.
9 #include "../sf/service.h"
10 #include "../services/usb.h"
11 #include "../kernel/event.h"
16 UsbHsInterfaceFilterFlags_idProduct =
BIT(1),
17 UsbHsInterfaceFilterFlags_bcdDevice_Min =
BIT(2),
18 UsbHsInterfaceFilterFlags_bcdDevice_Max =
BIT(3),
19 UsbHsInterfaceFilterFlags_bDeviceClass =
BIT(4),
20 UsbHsInterfaceFilterFlags_bDeviceSubClass =
BIT(5),
24 UsbHsInterfaceFilterFlags_bInterfaceClass =
BIT(7),
25 UsbHsInterfaceFilterFlags_bInterfaceSubClass =
BIT(8),
26 UsbHsInterfaceFilterFlags_bInterfaceProtocol =
BIT(9),
41 u8 bInterfaceSubClass;
42 u8 bInterfaceProtocol;
static bool usbHsIfIsActive(UsbHsClientIfSession *s)
Returns whether the specified interface session was initialized.
Definition: usbhs.h:173
u64 timestamp
Unknown u64 timestamp for when the device was inserted?
Definition: usbhs.h:76
uint8_t u8
8-bit unsigned integer.
Definition: types.h:19
u16 Flags
See UsbHsInterfaceFilterFlags. Setting this to 0 is equivalent to disabling filtering.
Definition: usbhs.h:32
Interface filtering struct.
Definition: usbhs.h:31
Kernel-mode event structure.
Definition: event.h:13
u16 bcdDevice_Min
Descriptor value must be >= bcdDevice_Min.
Definition: usbhs.h:35
void usbHsEpClose(UsbHsClientEpSession *s)
UsbHsClientEpSession.
Service * usbHsGetServiceSession(void)
Gets the Service object for the actual usb:hs service session.
@ UsbHsInterfaceFilterFlags_bDeviceProtocol
These use usb_interface_descriptor.
Definition: usbhs.h:21
Result usbHsQueryAcquiredInterfaces(UsbHsInterface *interfaces, size_t interfaces_maxsize, s32 *total_entries)
Returns an array of UsbHsInterface which were previously acquired.
Result usbHsIfResetDevice(UsbHsClientIfSession *s)
Resets the device: has the same affect as unplugging the device and plugging it back in.
UsbHsInterfaceFilterFlags
Definition: usbhs.h:13
Result usbHsIfGetAlternateInterface(UsbHsClientIfSession *s, UsbHsInterfaceInfo *inf, u8 id)
Gets an alternate interface.
@ UsbHsInterfaceFilterFlags_idVendor
These use usb_device_descriptor. Bit2..6 require [6.0.0+], these are ignored on eariler versions.
Definition: usbhs.h:15
Imported from libusb, with some adjustments.
Definition: usb.h:25
int32_t s32
32-bit signed integer.
Definition: types.h:27
Result usbHsIfGetInterface(UsbHsClientIfSession *s, UsbHsInterfaceInfo *inf)
Gets an interface.
Result usbHsEpPostBuffer(UsbHsClientEpSession *s, void *buffer, u32 size, u32 *transferredSize)
Uses a data transfer with the specified endpoint, this will block until the transfer finishes....
Imported from libusb, with some adjustments.
Definition: usb.h:35
Result usbHsIfOpenUsbEp(UsbHsClientIfSession *s, UsbHsClientEpSession *ep, u16 maxUrbCount, u32 maxXferSize, struct usb_endpoint_descriptor *desc)
Opens an endpoint.
UsbHsInterface inf
Initialized with the input interface from usbHsAcquireUsbIf, then overwritten with the cmd output....
Definition: usbhs.h:94
uint32_t u32
32-bit unsigned integer.
Definition: types.h:21
Result usbHsQueryAvailableInterfaces(const UsbHsInterfaceFilter *filter, UsbHsInterface *interfaces, size_t interfaces_maxsize, s32 *total_entries)
Returns an array of UsbHsInterface which are available.
Imported from libusb, with some adjustments.
Definition: usb.h:48
Event eventCtrlXfer
[2.0.0+] Signaled when CtrlXferAsync finishes.
Definition: usbhs.h:91
Result usbHsDestroyInterfaceAvailableEvent(Event *event, u8 index)
Destroys an event setup by usbHsCreateInterfaceAvailableEvent.
void usbHsExit(void)
Exit usb:hs.
uint64_t u64
64-bit unsigned integer.
Definition: types.h:22
Result usbHsAcquireUsbIf(UsbHsClientIfSession *s, UsbHsInterface *interface)
Acquires/opens the specified interface.
Event event0
Unknown.
Definition: usbhs.h:90
The interface service object. These Events have autoclear=false.
Definition: usbhs.h:88
u32 Result
Function error code result type.
Definition: types.h:44
Result usbHsInitialize(void)
Initialize usb:hs.
Event eventXfer
[2.0.0+] Signaled when PostBufferAsync finishes.
Definition: usbhs.h:99
Result usbHsQueryAllInterfaces(const UsbHsInterfaceFilter *filter, UsbHsInterface *interfaces, size_t interfaces_maxsize, s32 *total_entries)
Returns an array of all UsbHsInterface.
Interface struct. Note that devices have a seperate UsbHsInterface for each interface.
Definition: usbhs.h:65
u16 bcdDevice_Max
Descriptor value must be <= bcdDevice_Max.
Definition: usbhs.h:36
#define PACKED
Packs a struct so that it won't include padding bytes.
Definition: types.h:59
static s32 usbHsIfGetID(UsbHsClientIfSession *s)
Returns the ID which can be used for comparing with the ID in the output interfaces from usbHsQueryAc...
Definition: usbhs.h:178
void usbHsIfClose(UsbHsClientIfSession *s)
UsbHsClientIfSession.
#define BIT(n)
Creates a bitmask from a bit number.
Definition: types.h:54
Service object structure.
Definition: service.h:13
Result usbHsIfGetCurrentFrame(UsbHsClientIfSession *s, u32 *out)
On [1.0.0] this is stubbed, just returns 0 with out=0.
Result usbHsCreateInterfaceAvailableEvent(Event *out_event, bool autoclear, u8 index, const UsbHsInterfaceFilter *filter)
Creates an event which is signaled when an interface is available which passes the filtering checks.
static bool serviceIsActive(Service *s)
Returns whether a service has been initialized.
Definition: service.h:91
Event * usbHsGetInterfaceStateChangeEvent(void)
Returns the Event loaded during init with autoclear=false.
Imported from libusb, with some adjustments.
Definition: usb.h:78
Descriptors which are not available are set to all-zero.
Definition: usbhs.h:47
uint16_t u16
16-bit unsigned integer.
Definition: types.h:20
Result usbHsIfCtrlXfer(UsbHsClientIfSession *s, u8 bmRequestType, u8 bRequest, u16 wValue, u16 wIndex, u16 wLength, void *buffer, u32 *transferredSize)
Uses a control transfer, this will block until the transfer finishes. The buffer address and size sho...
Imported from libusb, with some adjustments.
Definition: usb.h:66
Result usbHsIfSetInterface(UsbHsClientIfSession *s, UsbHsInterfaceInfo *inf, u8 id)
Selects an interface.