RetroArch
Classes | Macros | Functions | Variables
usbkeyboard.c File Reference
#include <string.h>
#include <malloc.h>
#include <gccore.h>
#include <ogc/usb.h>
#include <wiikeyboard/usbkeyboard.h>
Include dependency graph for usbkeyboard.c:

Classes

struct  ukbd_data
 
struct  ukbd
 

Macros

#define HEAP_SIZE   4096
 
#define DEVLIST_MAXSIZE   8
 
#define KEY_ERROR   0x01
 
#define MAXKEYCODE   6
 
#define USB_MOD_CTRL_L   0x01
 
#define USB_MOD_SHIFT_L   0x02
 
#define USB_MOD_ALT_L   0x04
 
#define USB_MOD_META_L   0x08
 
#define USB_MOD_CTRL_R   0x10
 
#define USB_MOD_SHIFT_R   0x20
 
#define USB_MOD_ALT_R   0x40
 
#define USB_MOD_META_R   0x80
 
#define MODMAPSIZE   (sizeof(_ukbd_mod_map)/sizeof(_ukbd_mod_map[0]))
 

Functions

static void _submit (USBKeyboard_eventType type, u8 code)
 
static s32 _disconnect (s32 retval, void *data)
 
static s32 _get_protocol (void)
 
static s32 _set_protocol (u8 protocol)
 
static s32 _get_input_report (void)
 
static s32 _set_output_report (void)
 
s32 USBKeyboard_Initialize (void)
 
s32 USBKeyboard_Deinitialize (void)
 
s32 USBKeyboard_Open (const eventcallback cb)
 
void USBKeyboard_Close (void)
 
bool USBKeyboard_IsConnected (void)
 
s32 USBKeyboard_Scan (void)
 
s32 USBKeyboard_SetLed (const USBKeyboard_led led, bool on)
 
s32 USBKeyboard_ToggleLed (const USBKeyboard_led led)
 

Variables

struct ukbd_data ATTRIBUTE_PACKED
 
static s32 hId = -1
 
static struct ukbd_kbd = NULL
 
static u8 _ukbd_mod_map [][2]
 

Macro Definition Documentation

◆ DEVLIST_MAXSIZE

#define DEVLIST_MAXSIZE   8

◆ HEAP_SIZE

#define HEAP_SIZE   4096

◆ KEY_ERROR

#define KEY_ERROR   0x01

◆ MAXKEYCODE

#define MAXKEYCODE   6

◆ MODMAPSIZE

#define MODMAPSIZE   (sizeof(_ukbd_mod_map)/sizeof(_ukbd_mod_map[0]))

◆ USB_MOD_ALT_L

#define USB_MOD_ALT_L   0x04

◆ USB_MOD_ALT_R

#define USB_MOD_ALT_R   0x40

◆ USB_MOD_CTRL_L

#define USB_MOD_CTRL_L   0x01

◆ USB_MOD_CTRL_R

#define USB_MOD_CTRL_R   0x10

◆ USB_MOD_META_L

#define USB_MOD_META_L   0x08

◆ USB_MOD_META_R

#define USB_MOD_META_R   0x80

◆ USB_MOD_SHIFT_L

#define USB_MOD_SHIFT_L   0x02

◆ USB_MOD_SHIFT_R

#define USB_MOD_SHIFT_R   0x20

Function Documentation

◆ _disconnect()

static s32 _disconnect ( s32  retval,
void data 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _get_input_report()

static s32 _get_input_report ( void  )
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _get_protocol()

static s32 _get_protocol ( void  )
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _set_output_report()

static s32 _set_output_report ( void  )
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _set_protocol()

static s32 _set_protocol ( u8  protocol)
static
Here is the caller graph for this function:

◆ _submit()

static void _submit ( USBKeyboard_eventType  type,
u8  code 
)
static
Here is the caller graph for this function:

◆ USBKeyboard_Close()

void USBKeyboard_Close ( void  )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ USBKeyboard_Deinitialize()

s32 USBKeyboard_Deinitialize ( void  )
Here is the caller graph for this function:

◆ USBKeyboard_Initialize()

s32 USBKeyboard_Initialize ( void  )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ USBKeyboard_IsConnected()

bool USBKeyboard_IsConnected ( void  )
Here is the caller graph for this function:

◆ USBKeyboard_Open()

s32 USBKeyboard_Open ( const eventcallback  cb)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ USBKeyboard_Scan()

s32 USBKeyboard_Scan ( void  )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ USBKeyboard_SetLed()

s32 USBKeyboard_SetLed ( const USBKeyboard_led  led,
bool  on 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ USBKeyboard_ToggleLed()

s32 USBKeyboard_ToggleLed ( const USBKeyboard_led  led)
Here is the call graph for this function:

Variable Documentation

◆ _kbd

struct ukbd* _kbd = NULL
static

◆ _ukbd_mod_map

u8 _ukbd_mod_map[][2]
static
Initial value:
= {
{ USB_MOD_CTRL_L, 224 },
{ USB_MOD_SHIFT_L, 225 },
{ USB_MOD_ALT_L, 226 },
{ USB_MOD_META_L, 227 },
{ USB_MOD_CTRL_R, 228 },
{ USB_MOD_SHIFT_R, 229 },
{ USB_MOD_ALT_R, 230 },
{ USB_MOD_META_R, 231 }
}
#define USB_MOD_META_L
Definition: usbkeyboard.c:46
#define USB_MOD_META_R
Definition: usbkeyboard.c:50
#define USB_MOD_CTRL_L
Definition: usbkeyboard.c:43
#define USB_MOD_SHIFT_L
Definition: usbkeyboard.c:44
#define USB_MOD_ALT_R
Definition: usbkeyboard.c:49
#define USB_MOD_ALT_L
Definition: usbkeyboard.c:45
#define USB_MOD_SHIFT_R
Definition: usbkeyboard.c:48
#define USB_MOD_CTRL_R
Definition: usbkeyboard.c:47

◆ ATTRIBUTE_PACKED

struct ukbd_data ATTRIBUTE_PACKED

◆ hId

s32 hId = -1
static