Crate vcs_classic_hid[][src]

VCS Classic Joystick HID library.

This crate uses hidapi for finding and using Atari VCS classic joysticks.

With this crate, an assortment of facilities are provided for reading the current state of the device and, more importantly, send force feedback and LED manipulation messages.

Finding a device

The functions open, open_serial, and open_all are helper functions for opening devices for access to a classic controller via hidapi. The result provides an HidDevice.

let device = vcs_classic_hid::open()?;

Using the device

Raw access to the HID device can still be done through the interface provided, but a set of facilities are provided through the implemented Device trait and additional functions and data types.

Receiving input state

A State value represents a possible input state of the classic controller, and can be created from a device report via State::from_report. However, this is not very convenient, and may return stale input

The function process_input handles all input state events in queue and returns a State instance.

let mut device = vcs_classic_hid::open()?;
match vcs_classic_hid::process_input(&mut device)? {
    Some(state) => {
        // use state
        let _fuji_button_down = state.button_fuji;
    None => {
        // no user input

Changing LED state

Both the light on the Fuji button and the ring of 24 LEDs can be manipulated programmatically. To set an exact state of the LEDs, create an LedReport and send it to the device.

For example, to light up all LEDs in the controller’s ring to the maximum:

use vcs_classic_hid::Device;
let led = vcs_classic_hid::LedReport::filled(0xFF);
Device::write(&mut device, led)?;

To cancel LED manipulation and let the controller itself manipulate them based on user input (which is the default behavior), use reset_leds:

use vcs_classic_hid::Device;


pub use hidapi;
pub use force_feedback::FfReport;
pub use led::LedReport;
pub use input::State;
pub use input::StickPosition;
pub use input::process_input;



Force feedback module


Controller input handling module


LED manipulation module



Generic interface for human interaction devices.



Inspect the list of devices available and open the first VCS classic controller device found.


Find and open all classic controller devices available into a list.


Inspect the list of devices available and open a classic controller device by path.


and open a classic controller device by path.