Monado OpenXR Runtime
|
Driver for the PlayStation Sense motion controllers. More...
Files | |
file | pssense_driver.c |
PlayStation Sense controller prober and driver code. | |
file | pssense_interface.h |
Interface to PlayStation Sense driver. | |
Data Structures | |
struct | pssense_i16_le |
16-bit little-endian int More... | |
struct | pssense_i32_le |
32-bit little-endian int More... | |
struct | pssense_input_report |
HID input report data packet. More... | |
struct | pssense_output_report |
HID output report data packet. More... | |
struct | pssense_feature_report |
HID output report data packet. More... | |
struct | pssense_input_state |
PlayStation Sense state parsed from a data packet. More... | |
struct | pssense_device |
A single PlayStation Sense Controller. More... | |
Macros | |
#define | PSSENSE_TRACE(p, ...) U_LOG_XDEV_IFL_T(&p->base, p->log_level, __VA_ARGS__) |
#define | PSSENSE_DEBUG(p, ...) U_LOG_XDEV_IFL_D(&p->base, p->log_level, __VA_ARGS__) |
#define | PSSENSE_WARN(p, ...) U_LOG_XDEV_IFL_W(&p->base, p->log_level, __VA_ARGS__) |
#define | PSSENSE_ERROR(p, ...) U_LOG_XDEV_IFL_E(&p->base, p->log_level, __VA_ARGS__) |
#define | DEG_TO_RAD(DEG) (DEG * M_PI / 180.) |
#define | INPUT_REPORT_LENGTH 78 |
#define | OUTPUT_REPORT_LENGTH 78 |
#define | FEATURE_REPORT_LENGTH 64 |
#define | CALIBRATION_DATA_LENGTH 116 |
#define | SET_INPUT(NAME) (pssense->base.inputs[PSSENSE_INDEX_##NAME].name = XRT_INPUT_PSSENSE_##NAME) |
Enumerations | |
enum | pssense_input_index { PSSENSE_INDEX_PS_CLICK , PSSENSE_INDEX_SHARE_CLICK , PSSENSE_INDEX_OPTIONS_CLICK , PSSENSE_INDEX_SQUARE_CLICK , PSSENSE_INDEX_SQUARE_TOUCH , PSSENSE_INDEX_TRIANGLE_CLICK , PSSENSE_INDEX_TRIANGLE_TOUCH , PSSENSE_INDEX_CROSS_CLICK , PSSENSE_INDEX_CROSS_TOUCH , PSSENSE_INDEX_CIRCLE_CLICK , PSSENSE_INDEX_CIRCLE_TOUCH , PSSENSE_INDEX_SQUEEZE_CLICK , PSSENSE_INDEX_SQUEEZE_TOUCH , PSSENSE_INDEX_SQUEEZE_PROXIMITY , PSSENSE_INDEX_TRIGGER_CLICK , PSSENSE_INDEX_TRIGGER_TOUCH , PSSENSE_INDEX_TRIGGER_VALUE , PSSENSE_INDEX_TRIGGER_PROXIMITY , PSSENSE_INDEX_THUMBSTICK , PSSENSE_INDEX_THUMBSTICK_CLICK , PSSENSE_INDEX_THUMBSTICK_TOUCH , PSSENSE_INDEX_GRIP_POSE , PSSENSE_INDEX_AIM_POSE } |
Indices where each input is in the input list. More... | |
Functions | |
static uint32_t | pssense_i32_le_to_u32 (const struct pssense_i32_le *from) |
static struct pssense_i32_le | pssense_u32_to_i32_le (uint32_t from) |
static int16_t | pssense_i16_le_to_i16 (const struct pssense_i16_le *from) |
static uint32_t | crc32_le (uint32_t crc, uint8_t const *p, size_t len) |
static bool | pssense_read_one_packet (struct pssense_device *pssense, uint8_t *buffer, size_t size, bool check_size) |
Reads one packet from the device, handles time out, locking and checking if the thread has been told to shut down. More... | |
static bool | pssense_parse_packet (struct pssense_device *pssense, struct pssense_input_report *data, struct pssense_input_state *input) |
static void | pssense_update_fusion (struct pssense_device *pssense) |
static void | pssense_send_output_report_locked (struct pssense_device *pssense) |
static void * | pssense_run_thread (void *ptr) |
static void | pssense_device_destroy (struct xrt_device *xdev) |
static xrt_result_t | pssense_device_update_inputs (struct xrt_device *xdev) |
static void | pssense_set_output (struct xrt_device *xdev, enum xrt_output_name name, const union xrt_output_value *value) |
static void | pssense_get_fusion_pose (struct pssense_device *pssense, enum xrt_input_name name, int64_t at_timestamp_ns, struct xrt_space_relation *out_relation) |
static xrt_result_t | pssense_get_tracked_pose (struct xrt_device *xdev, enum xrt_input_name name, int64_t at_timestamp_ns, struct xrt_space_relation *out_relation) |
static xrt_result_t | pssense_get_battery_status (struct xrt_device *xdev, bool *out_present, bool *out_charging, float *out_charge) |
bool | pssense_get_calibration_data (struct pssense_device *pssense) |
Retrieving the calibration data report will switch the Sense controller from compat mode into full mode. More... | |
int | pssense_found (struct xrt_prober *xp, struct xrt_prober_device **devices, size_t device_count, size_t index, cJSON *attached_data, struct xrt_device **out_xdevs) |
Probing function for PlayStation Sense devices. More... | |
Variables | |
static struct xrt_binding_input_pair | simple_inputs_pssense [4] |
static struct xrt_binding_output_pair | simple_outputs_pssense [1] |
static struct xrt_binding_profile | binding_profiles_pssense [1] |
const uint8_t | INPUT_REPORT_ID = 0x31 |
const uint8_t | OUTPUT_REPORT_ID = 0x31 |
const uint8_t | OUTPUT_REPORT_TAG = 0x10 |
const uint8_t | CALIBRATION_DATA_FEATURE_REPORT_ID = 0x05 |
const uint8_t | CALIBRATION_DATA_PART_ID_1 = 0 |
const uint8_t | CALIBRATION_DATA_PART_ID_2 = 0x81 |
const uint8_t | INPUT_REPORT_CRC32_SEED = 0xa1 |
const uint8_t | OUTPUT_REPORT_CRC32_SEED = 0xa2 |
const uint8_t | FEATURE_REPORT_CRC32_SEED = 0xa3 |
const double | PSSENSE_GYRO_SCALE_DEG = 180.0 / 1024 |
Gyro read value range is +-32768. More... | |
const double | PSSENSE_ACCEL_SCALE = MATH_GRAVITY_M_S2 / 4096 |
Accelerometer read value range is +-32768 and covers +-8 g. More... | |
const uint8_t | VIBRATE_ENABLE_BITS = 0x03 |
Flag bits to enable setting vibration in an output report. More... | |
const uint8_t | VIBRATE_MODE_HIGH_120HZ = 0x00 |
Pure 120Hz vibration. More... | |
const uint8_t | VIBRATE_MODE_LOW_60HZ = 0x20 |
Pure 60Hz vibration. More... | |
const uint8_t | VIBRATE_MODE_CLASSIC_RUMBLE = 0x40 |
Emulates a legacy vibration motor. More... | |
const uint8_t | VIBRATE_MODE_DIET_RUMBLE = 0x60 |
Softer rumble emulation, like an engine running. More... | |
const uint8_t | TRIGGER_FEEDBACK_ENABLE_BITS = 0x04 |
Flag bits to enable setting trigger feedback in an output report. More... | |
const uint8_t | TRIGGER_FEEDBACK_MODE_NONE = 0x00 |
Clear the trigger feedback setting. More... | |
const uint8_t | TRIGGER_FEEDBACK_MODE_CONSTANT = 0x01 |
Constant resistance throughout the trigger movement. More... | |
const uint8_t | TRIGGER_FEEDBACK_MODE_CATCH = 0x02 |
A single point of resistance at the beginning of the trigger, right before the click flag is activated. More... | |
const uint8_t | CHARGE_STATE_DISCHARGING = 0x00 |
const uint8_t | CHARGE_STATE_CHARGING = 0x01 |
const uint8_t | CHARGE_STATE_FULL = 0x02 |
const uint8_t | CHARGE_STATE_ABNORMAL_VOLTAGE = 0x0A |
const uint8_t | CHARGE_STATE_ABNORMAL_TEMP = 0x0B |
const uint8_t | CHARGE_STATE_CHARGING_ERROR = 0x0F |
const uint32_t | CRC_POLYNOMIAL = 0xedb88320 |
Driver for the PlayStation Sense motion controllers.
enum pssense_input_index |
#include <drivers/pssense/pssense_driver.c>
Indices where each input is in the input list.
int pssense_found | ( | struct xrt_prober * | xp, |
struct xrt_prober_device ** | devices, | ||
size_t | device_count, | ||
size_t | index, | ||
cJSON * | attached_data, | ||
struct xrt_device ** | out_xdevs | ||
) |
#include <drivers/pssense/pssense_driver.c>
Probing function for PlayStation Sense devices.
References xrt_prober::xrt_prober_get_string_descriptor(), and xrt_prober::xrt_prober_open_hid_interface().
bool pssense_get_calibration_data | ( | struct pssense_device * | pssense | ) |
#include <drivers/pssense/pssense_driver.c>
Retrieving the calibration data report will switch the Sense controller from compat mode into full mode.
|
static |
#include <drivers/pssense/pssense_driver.c>
References m_imu_3dof::gyro, and xrt_quat::math_quat_rotate_derivative().
|
static |
#include <drivers/pssense/pssense_driver.c>
Reads one packet from the device, handles time out, locking and checking if the thread has been told to shut down.
References os_hid_device::os_hid_read(), os_thread_helper::os_thread_helper_is_running_locked(), os_thread_helper::os_thread_helper_lock(), and os_thread_helper::os_thread_helper_unlock().
|
static |
#include <drivers/pssense/pssense_driver.c>
const double PSSENSE_ACCEL_SCALE = MATH_GRAVITY_M_S2 / 4096 |
#include <drivers/pssense/pssense_driver.c>
Accelerometer read value range is +-32768 and covers +-8 g.
const double PSSENSE_GYRO_SCALE_DEG = 180.0 / 1024 |
#include <drivers/pssense/pssense_driver.c>
Gyro read value range is +-32768.
|
static |
#include <drivers/pssense/pssense_driver.c>
|
static |
#include <drivers/pssense/pssense_driver.c>
const uint8_t TRIGGER_FEEDBACK_ENABLE_BITS = 0x04 |
#include <drivers/pssense/pssense_driver.c>
Flag bits to enable setting trigger feedback in an output report.
const uint8_t TRIGGER_FEEDBACK_MODE_CATCH = 0x02 |
#include <drivers/pssense/pssense_driver.c>
A single point of resistance at the beginning of the trigger, right before the click flag is activated.
const uint8_t TRIGGER_FEEDBACK_MODE_CONSTANT = 0x01 |
#include <drivers/pssense/pssense_driver.c>
Constant resistance throughout the trigger movement.
const uint8_t TRIGGER_FEEDBACK_MODE_NONE = 0x00 |
#include <drivers/pssense/pssense_driver.c>
Clear the trigger feedback setting.
const uint8_t VIBRATE_ENABLE_BITS = 0x03 |
#include <drivers/pssense/pssense_driver.c>
Flag bits to enable setting vibration in an output report.
const uint8_t VIBRATE_MODE_CLASSIC_RUMBLE = 0x40 |
#include <drivers/pssense/pssense_driver.c>
Emulates a legacy vibration motor.
const uint8_t VIBRATE_MODE_DIET_RUMBLE = 0x60 |
#include <drivers/pssense/pssense_driver.c>
Softer rumble emulation, like an engine running.
const uint8_t VIBRATE_MODE_HIGH_120HZ = 0x00 |
#include <drivers/pssense/pssense_driver.c>
Pure 120Hz vibration.
const uint8_t VIBRATE_MODE_LOW_60HZ = 0x20 |
#include <drivers/pssense/pssense_driver.c>
Pure 60Hz vibration.