Source
"Enable mouse and keyboard emulation (lizard mode) when the gamepad is not in use");
// SPDX-License-Identifier: GPL-2.0+
/*
* HID driver for Valve Steam Controller
*
* Copyright (c) 2018 Rodrigo Rivas Costa <rodrigorivascosta@gmail.com>
*
* Supports both the wired and wireless interfaces.
*
* This controller has a builtin emulation of mouse and keyboard: the right pad
* can be used as a mouse, the shoulder buttons are mouse buttons, A and B
* buttons are ENTER and ESCAPE, and so on. This is implemented as additional
* HID interfaces.
*
* This is known as the "lizard mode", because apparently lizards like to use
* the computer from the coach, without a proper mouse and keyboard.
*
* This driver will disable the lizard mode when the input device is opened
* and re-enable it when the input device is closed, so as not to break user
* mode behaviour. The lizard_mode parameter can be used to change that.
*
* There are a few user space applications (notably Steam Client) that use
* the hidraw interface directly to create input devices (XTest, uinput...).
* In order to avoid breaking them this driver creates a layered hidraw device,
* so it can detect when the client is running and then:
* - it will not send any command to the controller.
* - this input device will be removed, to avoid double input of the same
* user action.
* When the client is closed, this input device will be created again.
*
* For additional functions, such as changing the right-pad margin or switching
* the led, you can use the user-space tool at:
*
* https://github.com/rodrigorc/steamctrl
*/
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Rodrigo Rivas Costa <rodrigorivascosta@gmail.com>");
static bool lizard_mode = true;
static DEFINE_MUTEX(steam_devices_lock);
static LIST_HEAD(steam_devices);
/* Touch pads are 40 mm in diameter and 65535 units */
/* Trigger runs are about 5 mm and 256 units */
/* Joystick runs are about 5 mm and 256 units */