Loading drivers/hid/hid-qvr.c +11 −13 Original line number Diff line number Diff line Loading @@ -45,7 +45,7 @@ #include "hid-qvr.h" #include "hid-trace.h" #define WAIT_EVENT_INT_TOUT 1000 #define WAIT_EVENT_INT_TOUT 20 #define QVR_START_IMU _IO('q', 1) #define QVR_STOP_IMU _IO('q', 2) Loading Loading @@ -102,8 +102,6 @@ struct qvr_external_sensor { int fd; }; const static int msg_size = 368; static DECLARE_WAIT_QUEUE_HEAD(wq); static struct qvr_external_sensor qvr_external_sensor; Loading Loading @@ -248,13 +246,13 @@ static int qvr_send_package_wrap(u8 *message, int msize, struct hid_device *hid) struct external_imu_format imuData = { 0 }; struct qvr_buf_index *index_buf; /* * Actual message size is 369 bytes * to make it 8 byte aligned we created a structure of size 368 bytes. * Ignoring the first byte 'report id' (which is always 1) * */ memcpy((void *)&imuData, (void *)message + 1, msg_size); if (msize != sizeof(struct external_imu_format)) { pr_err("%s: data size mismatch %d\n", __func__, msize); return -EPROTO; } memcpy((void *)&imuData, (void *)message, sizeof(struct external_imu_format)); if (!sensor->ts_base) sensor->ts_base = ktime_to_ns(ktime_get_boottime()); Loading @@ -268,10 +266,10 @@ static int qvr_send_package_wrap(u8 *message, int msize, struct hid_device *hid) data = (struct qvr_sensor_t *)&(sensor_buf[buf_index]); if (sensor->ts_offset > imuData.gts0) data->ats = sensor->ts_base + ((sensor->ts_offset - imuData.gts0) * 100); sensor->ts_offset - imuData.gts0; else data->ats = sensor->ts_base + ((imuData.gts0 - sensor->ts_offset) * 100); imuData.gts0 - sensor->ts_offset; if (imuData.mts0 == 0) data->mts = 0; else Loading Loading @@ -416,7 +414,7 @@ static ssize_t ts_base_store(struct kobject *kobj, static ssize_t ts_offset_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { return snprintf(buf, 16, "%lld\n", qvr_external_sensor.ts_offset * 100); return snprintf(buf, 16, "%lld\n", qvr_external_sensor.ts_offset); } static ssize_t ts_offset_store(struct kobject *kobj, Loading drivers/hid/hid-qvr.h +27 −131 Original line number Diff line number Diff line Loading @@ -30,143 +30,39 @@ #define QVR_HID_REQUEST_REPORT_SIZE 64 struct external_imu_format { s16 temp0; s16 temp1; s16 temp2; s16 temp3; u8 reportID; u8 padding; u16 version; u16 numIMUs; u16 numSamplesPerImuPacket; u16 totalPayloadSize; u8 reservedPadding[28]; s16 imuID; s16 sampleID; s16 temperature; u64 gts0; u64 gts1; u64 gts2; u64 gts3; s16 gx0; s16 gx1; s16 gx2; s16 gx3; s16 gx4; s16 gx5; s16 gx6; s16 gx7; s16 gx8; s16 gx9; s16 gx10; s16 gx11; s16 gx12; s16 gx13; s16 gx14; s16 gx15; s16 gx16; s16 gx17; s16 gx18; s16 gx19; s16 gx20; s16 gx21; s16 gx22; s16 gx23; s16 gx24; s16 gx25; s16 gx26; s16 gx27; s16 gx28; s16 gx29; s16 gx30; s16 gx31; s16 gy0; s16 gy1; s16 gy2; s16 gy3; s16 gy4; s16 gy5; s16 gy6; s16 gy7; s16 gy8; s16 gy9; s16 gy10; s16 gy11; s16 gy12; s16 gy13; s16 gy14; s16 gy15; s16 gy16; s16 gy17; s16 gy18; s16 gy19; s16 gy20; s16 gy21; s16 gy22; s16 gy23; s16 gy24; s16 gy25; s16 gy26; s16 gy27; s16 gy28; s16 gy29; s16 gy30; s16 gy31; s16 gz0; s16 gz1; s16 gz2; s16 gz3; s16 gz4; s16 gz5; s16 gz6; s16 gz7; s16 gz8; s16 gz9; s16 gz10; s16 gz11; s16 gz12; s16 gz13; s16 gz14; s16 gz15; s16 gz16; s16 gz17; s16 gz18; s16 gz19; s16 gz20; s16 gz21; s16 gz22; s16 gz23; s16 gz24; s16 gz25; s16 gz26; s16 gz27; s16 gz28; s16 gz29; s16 gz30; s16 gz31; u32 gNumerator; u32 gDenominator; s32 gx0; s32 gy0; s32 gz0; u64 ats0; u64 ats1; u64 ats2; u64 ats3; u32 aNumerator; u32 aDenominator; s32 ax0; s32 ax1; s32 ax2; s32 ax3; s32 ay0; s32 ay1; s32 ay2; s32 ay3; s32 az0; s32 az1; s32 az2; s32 az3; u64 mts0; u64 mts1; u64 mts2; u64 mts3; s16 mx0; s16 mx1; s16 mx2; s16 mx3; s16 my0; s16 my1; s16 my2; s16 my3; s16 mz0; s16 mz1; s16 mz2; s16 mz3; //368 bytes }; u32 mNumerator; u32 mDenominator; s32 mx0; s32 my0; s32 mz0; } __packed; void qvr_clear_def_parmeter(void); void qvr_init(struct hid_device *hdev); Loading Loading
drivers/hid/hid-qvr.c +11 −13 Original line number Diff line number Diff line Loading @@ -45,7 +45,7 @@ #include "hid-qvr.h" #include "hid-trace.h" #define WAIT_EVENT_INT_TOUT 1000 #define WAIT_EVENT_INT_TOUT 20 #define QVR_START_IMU _IO('q', 1) #define QVR_STOP_IMU _IO('q', 2) Loading Loading @@ -102,8 +102,6 @@ struct qvr_external_sensor { int fd; }; const static int msg_size = 368; static DECLARE_WAIT_QUEUE_HEAD(wq); static struct qvr_external_sensor qvr_external_sensor; Loading Loading @@ -248,13 +246,13 @@ static int qvr_send_package_wrap(u8 *message, int msize, struct hid_device *hid) struct external_imu_format imuData = { 0 }; struct qvr_buf_index *index_buf; /* * Actual message size is 369 bytes * to make it 8 byte aligned we created a structure of size 368 bytes. * Ignoring the first byte 'report id' (which is always 1) * */ memcpy((void *)&imuData, (void *)message + 1, msg_size); if (msize != sizeof(struct external_imu_format)) { pr_err("%s: data size mismatch %d\n", __func__, msize); return -EPROTO; } memcpy((void *)&imuData, (void *)message, sizeof(struct external_imu_format)); if (!sensor->ts_base) sensor->ts_base = ktime_to_ns(ktime_get_boottime()); Loading @@ -268,10 +266,10 @@ static int qvr_send_package_wrap(u8 *message, int msize, struct hid_device *hid) data = (struct qvr_sensor_t *)&(sensor_buf[buf_index]); if (sensor->ts_offset > imuData.gts0) data->ats = sensor->ts_base + ((sensor->ts_offset - imuData.gts0) * 100); sensor->ts_offset - imuData.gts0; else data->ats = sensor->ts_base + ((imuData.gts0 - sensor->ts_offset) * 100); imuData.gts0 - sensor->ts_offset; if (imuData.mts0 == 0) data->mts = 0; else Loading Loading @@ -416,7 +414,7 @@ static ssize_t ts_base_store(struct kobject *kobj, static ssize_t ts_offset_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { return snprintf(buf, 16, "%lld\n", qvr_external_sensor.ts_offset * 100); return snprintf(buf, 16, "%lld\n", qvr_external_sensor.ts_offset); } static ssize_t ts_offset_store(struct kobject *kobj, Loading
drivers/hid/hid-qvr.h +27 −131 Original line number Diff line number Diff line Loading @@ -30,143 +30,39 @@ #define QVR_HID_REQUEST_REPORT_SIZE 64 struct external_imu_format { s16 temp0; s16 temp1; s16 temp2; s16 temp3; u8 reportID; u8 padding; u16 version; u16 numIMUs; u16 numSamplesPerImuPacket; u16 totalPayloadSize; u8 reservedPadding[28]; s16 imuID; s16 sampleID; s16 temperature; u64 gts0; u64 gts1; u64 gts2; u64 gts3; s16 gx0; s16 gx1; s16 gx2; s16 gx3; s16 gx4; s16 gx5; s16 gx6; s16 gx7; s16 gx8; s16 gx9; s16 gx10; s16 gx11; s16 gx12; s16 gx13; s16 gx14; s16 gx15; s16 gx16; s16 gx17; s16 gx18; s16 gx19; s16 gx20; s16 gx21; s16 gx22; s16 gx23; s16 gx24; s16 gx25; s16 gx26; s16 gx27; s16 gx28; s16 gx29; s16 gx30; s16 gx31; s16 gy0; s16 gy1; s16 gy2; s16 gy3; s16 gy4; s16 gy5; s16 gy6; s16 gy7; s16 gy8; s16 gy9; s16 gy10; s16 gy11; s16 gy12; s16 gy13; s16 gy14; s16 gy15; s16 gy16; s16 gy17; s16 gy18; s16 gy19; s16 gy20; s16 gy21; s16 gy22; s16 gy23; s16 gy24; s16 gy25; s16 gy26; s16 gy27; s16 gy28; s16 gy29; s16 gy30; s16 gy31; s16 gz0; s16 gz1; s16 gz2; s16 gz3; s16 gz4; s16 gz5; s16 gz6; s16 gz7; s16 gz8; s16 gz9; s16 gz10; s16 gz11; s16 gz12; s16 gz13; s16 gz14; s16 gz15; s16 gz16; s16 gz17; s16 gz18; s16 gz19; s16 gz20; s16 gz21; s16 gz22; s16 gz23; s16 gz24; s16 gz25; s16 gz26; s16 gz27; s16 gz28; s16 gz29; s16 gz30; s16 gz31; u32 gNumerator; u32 gDenominator; s32 gx0; s32 gy0; s32 gz0; u64 ats0; u64 ats1; u64 ats2; u64 ats3; u32 aNumerator; u32 aDenominator; s32 ax0; s32 ax1; s32 ax2; s32 ax3; s32 ay0; s32 ay1; s32 ay2; s32 ay3; s32 az0; s32 az1; s32 az2; s32 az3; u64 mts0; u64 mts1; u64 mts2; u64 mts3; s16 mx0; s16 mx1; s16 mx2; s16 mx3; s16 my0; s16 my1; s16 my2; s16 my3; s16 mz0; s16 mz1; s16 mz2; s16 mz3; //368 bytes }; u32 mNumerator; u32 mDenominator; s32 mx0; s32 my0; s32 mz0; } __packed; void qvr_clear_def_parmeter(void); void qvr_init(struct hid_device *hdev); Loading