Crates.io | gcnctrlusb |
lib.rs | gcnctrlusb |
version | 0.1.0 |
source | src |
created_at | 2016-02-19 12:25:58.324998 |
updated_at | 2016-02-19 12:25:58.324998 |
description | Nintendo GameCube USB controller adapter interface |
homepage | |
repository | https://github.com/SkylerLipthay/gcnctrlusb |
max_upload_size | |
id | 4217 |
size | 69,571 |
Provides an interface for reading input from a Nintendo GameCube Controller Adapter for Wii U USB device.
Third party clones such as the 4-port Mayflash adapter in "PC mode" are also supported.
This library depends on libusb
, which is available as a dynamic library on many platforms including Linux, Windows, and Mac OS X.
Currently, rumble commands are unimplemented.
extern crate gcnctrlusb;
fn main() {
// Panics if `libusb` is not found or otherwise fails.
let mut scanner = gcnctrlusb::Scanner::new().unwrap();
// Panics if a valid device was not found.
let mut adapter = scanner.find_adapter().unwrap().unwrap();
// Panics if the USB driver fails to open a connection to the device.
let mut listener = adapter.listen().unwrap();
while let Ok(controllers) = listener.read() {
println!("Controller port 1: {:?}", controllers[0]);
}
}
Try cargo run --example log
for a pretty readout! This example requires a terminal that supports ANSI 256 colors and a terminal font that includes the bottom-half block character (▄). This example works best in a terminal with a black background.