aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Ferris <cferris@google.com>2022-12-13 03:44:26 +0000
committerChristopher Ferris <cferris@google.com>2022-12-14 00:26:54 +0000
commitacae70240d5d8f4b662cdf450dd395c19d91999d (patch)
tree73fa9a557e6cbd55222048f95d34a73b707e8ae7
parent32dc02960117bb47f77713c199f0be3722fd6c48 (diff)
downloadrmi4utils-acae70240d5d8f4b662cdf450dd395c19d91999d.tar.gz
Fix code to compile with new kernel 6.1 headers.main-16k-with-phones
The new kernel headers conflict with some of the names used in the hiddevice.cpp file. Change all of those so they are unique to that file and will not conflict in the future. Test: Builds. Test: Boots on panther. Change-Id: I46010a4c3b1914fa0c51ec840663cb75aadfd6a2
-rwxr-xr-xrmidevice/hiddevice.cpp40
1 files changed, 23 insertions, 17 deletions
diff --git a/rmidevice/hiddevice.cpp b/rmidevice/hiddevice.cpp
index b81d70a..4cedc5a 100755
--- a/rmidevice/hiddevice.cpp
+++ b/rmidevice/hiddevice.cpp
@@ -43,13 +43,19 @@
#define RMI_SET_LID_MODE_REPORT_ID 0xe // Feature Report
-enum hid_report_type {
- HID_REPORT_TYPE_UNKNOWN = 0x0,
- HID_REPORT_TYPE_INPUT = 0x81,
- HID_REPORT_TYPE_OUTPUT = 0x91,
- HID_REPORT_TYPE_FEATURE = 0xb1,
+// Make sure that none of the enums/macros conflict with possible
+// kernel definition/names.
+enum hid_rmi4_report_type {
+ HID_RMI4_REPORT_UNKNOWN = 0,
+ HID_RMI4_REPORT_INPUT = 1,
+ HID_RMI4_REPORT_OUTPUT = 2,
+ HID_RMI4_REPORT_FEATURE = 3,
};
+#define HID_RMI4_REPORT_TYPE_INPUT 0x81
+#define HID_RMI4_REPORT_TYPE_OUTPUT 0x91
+#define HID_RMI4_REPORT_TYPE_FEATURE 0xb1
+
#define HID_RMI4_REPORT_ID 0
#define HID_RMI4_READ_INPUT_COUNT 1
#define HID_RMI4_READ_INPUT_DATA 2
@@ -163,7 +169,7 @@ void HIDDevice::ParseReportDescriptor()
int totalReportSize = 0;
int reportSize = 0;
int reportCount = 0;
- enum hid_report_type hidReportType = HID_REPORT_TYPE_UNKNOWN;
+ enum hid_rmi4_report_type hidReportType = HID_RMI4_REPORT_UNKNOWN;
bool inCollection = false;
for (unsigned int i = 0; i < m_rptDesc.size; ++i) {
@@ -181,16 +187,16 @@ void HIDDevice::ParseReportDescriptor()
totalReportSize = (reportSize * reportCount) >> 3;
switch (hidReportType) {
- case HID_REPORT_TYPE_INPUT:
+ case HID_RMI4_REPORT_INPUT:
m_inputReportSize = totalReportSize + 1;
break;
- case HID_REPORT_TYPE_OUTPUT:
+ case HID_RMI4_REPORT_OUTPUT:
m_outputReportSize = totalReportSize + 1;
break;
- case HID_REPORT_TYPE_FEATURE:
+ case HID_RMI4_REPORT_FEATURE:
m_featureReportSize = totalReportSize + 1;
break;
- case HID_REPORT_TYPE_UNKNOWN:
+ case HID_RMI4_REPORT_UNKNOWN:
default:
break;
}
@@ -200,7 +206,7 @@ void HIDDevice::ParseReportDescriptor()
totalReportSize = 0;
reportSize = 0;
reportCount = 0;
- hidReportType = HID_REPORT_TYPE_UNKNOWN;
+ hidReportType = HID_RMI4_REPORT_UNKNOWN;
isReport = true;
}
@@ -224,14 +230,14 @@ void HIDDevice::ParseReportDescriptor()
hasVendorDefineLIDMode = true;
}
- if (m_rptDesc.value[i] == HID_REPORT_TYPE_INPUT)
- hidReportType = HID_REPORT_TYPE_INPUT;
+ if (m_rptDesc.value[i] == HID_RMI4_REPORT_TYPE_INPUT)
+ hidReportType = HID_RMI4_REPORT_INPUT;
- if (m_rptDesc.value[i] == HID_REPORT_TYPE_OUTPUT)
- hidReportType = HID_REPORT_TYPE_OUTPUT;
+ if (m_rptDesc.value[i] == HID_RMI4_REPORT_TYPE_OUTPUT)
+ hidReportType = HID_RMI4_REPORT_OUTPUT;
- if (m_rptDesc.value[i] == HID_REPORT_TYPE_FEATURE) {
- hidReportType = HID_REPORT_TYPE_FEATURE;
+ if (m_rptDesc.value[i] == HID_RMI4_REPORT_TYPE_FEATURE) {
+ hidReportType = HID_RMI4_REPORT_FEATURE;
}
}
}