In memory of Ben “bushing” Byer, who passed away on Monday, February 8th, 2016.

Difference between revisions of "Nsyskbd.rpl"

From WiiUBrew
Jump to navigation Jump to search
(Test programs worked so removed "types may be wrong" label + mior coreections)
m (Minor chanhes about unknown section of struct)
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
nsyskbd.rpl is the system library that allows applications to use USB keyboards plugged in the WiiU USB ports
+
nsyskbd.rpl is the system library that allows applications to use USB keyboards plugged in the WiiU USB ports; it supports up to multiple keyboards and assign a channel to each keyboard connected.
  
 
== Functions ==
 
== Functions ==
Line 7: Line 7:
 
!Description
 
!Description
 
|-
 
|-
|<code>char KBDSetup((void*)connection_callback,(void*)disconnection_callback,(void*)key_callback)</code>
+
|<code>uint8_t KBDSetup((void*)connection_callback,(void*)disconnection_callback,(void*)key_callback)</code>
|Initializes the USB keyboard library and return 0 if successfull; connection and disconnection callback are called repectively at the connection or disconnection of an usb keyboard; key callback is called when some key event occurs (2 times: press and release)
+
|Initializes the USB keyboard library and set callbacks; return 0 if the library was successfully initialized. connection_callback is called when an USB keyboard is connected with an uint8_t* as argument that specify the channel that was assigned to the keyboard. disconnection_callback is called when an USB keyboard is disconnected with an uint8_t* as argument that specify the channel of the keyboared that was disconnected. key_callback is called when a key event happens (press/release) and has a pointer to a key_state structure as argument
 
|-
 
|-
|<code>char KBDTeardown()</code>
+
|<code>uint8_t KBDTeardown()</code>
 
|Deinitializes the USB keyboard library and return 0 if the deinitialization was successfull
 
|Deinitializes the USB keyboard library and return 0 if the deinitialization was successfull
 
|-
 
|-
|<code>char KBDInit((void*)unknown,(void*)connection_callback,(void*)disconnection_callback,(void*)key_callback);</code>
+
|<code>uint8_t KBDInit((void*)unknown,(void*)connection_callback,(void*)disconnection_callback,(void*)key_callback);</code>
 
|Pass arguments to KBDSetup (probably an old function left for compatibility); should returns 0 if successfull
 
|Pass arguments to KBDSetup (probably an old function left for compatibility); should returns 0 if successfull
 
|-
 
|-
|<code>char KBDExit();</code>
+
|<code>uint8_t KBDExit();</code>
 
|Calls KBDTeardown() (probably an old function left for compatibility); should returns 0 if successfull
 
|Calls KBDTeardown() (probably an old function left for compatibility); should returns 0 if successfull
 +
|-
 +
|}
 +
 +
== Structures ==
 +
{| class="wikitable"
 +
!Prototype
 +
!Description
 +
|-
 +
|<syntaxhighlight lang="C">
 +
typedef struct {
 +
uint8_t ch; //Key channel
 +
uint8_t scancode; //Key scancode
 +
uint32_t state; //1=pressed; 0=releases; 3=keeping pressed
 +
uint32_t almost_known; //Seems something related to modifier keys (CTRL, ALT, SHIFT)
 +
uint16_t UTF16; //key value as an UTF16 char
 +
} key_state;
 +
</syntaxhighlight>
 +
|Used as argument of key_callback
 
|-
 
|-
 
|}
 
|}

Latest revision as of 14:28, 4 September 2016

nsyskbd.rpl is the system library that allows applications to use USB keyboards plugged in the WiiU USB ports; it supports up to multiple keyboards and assign a channel to each keyboard connected.

Functions

Initialisation

Prototype Description
uint8_t KBDSetup((void*)connection_callback,(void*)disconnection_callback,(void*)key_callback) Initializes the USB keyboard library and set callbacks; return 0 if the library was successfully initialized. connection_callback is called when an USB keyboard is connected with an uint8_t* as argument that specify the channel that was assigned to the keyboard. disconnection_callback is called when an USB keyboard is disconnected with an uint8_t* as argument that specify the channel of the keyboared that was disconnected. key_callback is called when a key event happens (press/release) and has a pointer to a key_state structure as argument
uint8_t KBDTeardown() Deinitializes the USB keyboard library and return 0 if the deinitialization was successfull
uint8_t KBDInit((void*)unknown,(void*)connection_callback,(void*)disconnection_callback,(void*)key_callback); Pass arguments to KBDSetup (probably an old function left for compatibility); should returns 0 if successfull
uint8_t KBDExit(); Calls KBDTeardown() (probably an old function left for compatibility); should returns 0 if successfull

Structures

Prototype Description
typedef struct {
	uint8_t ch; //Key channel
	uint8_t scancode; //Key scancode
	uint32_t state; //1=pressed; 0=releases; 3=keeping pressed
	uint32_t almost_known; //Seems something related to modifier keys (CTRL, ALT, SHIFT)
	uint16_t UTF16; //key value as an UTF16 char
} key_state;
Used as argument of key_callback