input: Add dualsense edge PID

This commit is contained in:
Megamouse
2023-06-12 00:10:52 +02:00
parent 635fed0427
commit 2409a0d04e
2 changed files with 11 additions and 10 deletions
+3 -3
View File
@@ -4,9 +4,9 @@
LOG_CHANNEL(ds4_log, "DS4"); LOG_CHANNEL(ds4_log, "DS4");
constexpr id_pair SONY_DS4_ID_0 = {0x054C, 0xBA0}; constexpr id_pair SONY_DS4_ID_0 = {0x054C, 0x0BA0}; // Dongle
constexpr id_pair SONY_DS4_ID_1 = {0x054C, 0x5C4}; constexpr id_pair SONY_DS4_ID_1 = {0x054C, 0x05C4}; // CUH-ZCT1x
constexpr id_pair SONY_DS4_ID_2 = {0x054C, 0x09CC}; constexpr id_pair SONY_DS4_ID_2 = {0x054C, 0x09CC}; // CUH-ZCT2x
constexpr id_pair ZEROPLUS_ID_0 = {0x0C12, 0x0E20}; constexpr id_pair ZEROPLUS_ID_0 = {0x0C12, 0x0E20};
+8 -7
View File
@@ -7,7 +7,7 @@ LOG_CHANNEL(dualsense_log, "DualSense");
template <> template <>
void fmt_class_string<DualSenseDevice::DualSenseDataMode>::format(std::string& out, u64 arg) void fmt_class_string<DualSenseDevice::DualSenseDataMode>::format(std::string& out, u64 arg)
{ {
format_enum(out, arg, [](auto mode) format_enum(out, arg, [](DualSenseDevice::DualSenseDataMode mode)
{ {
switch (mode) switch (mode)
{ {
@@ -30,7 +30,8 @@ namespace
constexpr u32 DUALSENSE_COMMON_REPORT_SIZE = 47; constexpr u32 DUALSENSE_COMMON_REPORT_SIZE = 47;
constexpr u32 DUALSENSE_INPUT_REPORT_GYRO_X_OFFSET = 15; constexpr u32 DUALSENSE_INPUT_REPORT_GYRO_X_OFFSET = 15;
constexpr id_pair SONY_DUALSENSE_ID_0 = {0x054C, 0x0CE6}; constexpr id_pair SONY_DUALSENSE_ID_0 = {0x054C, 0x0CE6}; // DualSense
constexpr id_pair SONY_DUALSENSE_ID_1 = {0x054C, 0x0DF2}; // DualSense Edge
enum enum
{ {
@@ -96,7 +97,7 @@ namespace
} }
dualsense_pad_handler::dualsense_pad_handler() dualsense_pad_handler::dualsense_pad_handler()
: hid_pad_handler<DualSenseDevice>(pad_handler::dualsense, {SONY_DUALSENSE_ID_0}) : hid_pad_handler<DualSenseDevice>(pad_handler::dualsense, {SONY_DUALSENSE_ID_0, SONY_DUALSENSE_ID_1})
{ {
// Unique names for the config files and our pad settings dialog // Unique names for the config files and our pad settings dialog
button_list = button_list =
@@ -417,7 +418,7 @@ dualsense_pad_handler::DataStatus dualsense_pad_handler::get_data(DualSenseDevic
} }
} }
memcpy(device->padData.data(), &buf[offset], 64); memcpy(device->padData.data(), &buf[offset], device->padData.size());
return DataStatus::NewData; return DataStatus::NewData;
} }
@@ -547,7 +548,7 @@ bool dualsense_pad_handler::get_calibration_data(DualSenseDevice* dualsense_devi
// Make sure data 'looks' valid, dongle will report invalid calibration data with no controller connected // Make sure data 'looks' valid, dongle will report invalid calibration data with no controller connected
for (const auto& data : dualsense_device->calib_data) for (const CalibData& data : dualsense_device->calib_data)
{ {
if (data.sens_denom == 0) if (data.sens_denom == 0)
{ {
@@ -648,7 +649,7 @@ void dualsense_pad_handler::get_extended_info(const pad_ensemble& binding)
pad->m_battery_level = dualsense_device->battery_level; pad->m_battery_level = dualsense_device->battery_level;
pad->m_cable_state = dualsense_device->cable_state; pad->m_cable_state = dualsense_device->cable_state;
auto& buf = dualsense_device->padData; const std::array<u8, 64>& buf = dualsense_device->padData;
// these values come already calibrated, all we need to do is convert to ds3 range // these values come already calibrated, all we need to do is convert to ds3 range
@@ -683,7 +684,7 @@ std::unordered_map<u64, u16> dualsense_pad_handler::get_button_values(const std:
if (!dualsense_dev) if (!dualsense_dev)
return keyBuffer; return keyBuffer;
auto buf = dualsense_dev->padData; const std::array<u8, 64>& buf = dualsense_dev->padData;
if (dualsense_dev->data_mode == DualSenseDevice::DualSenseDataMode::Simple) if (dualsense_dev->data_mode == DualSenseDevice::DualSenseDataMode::Simple)
{ {