Hi Florian, Thanks for your comments. On Thu, Jan 7, 2021 at 5:34 AM Florian Märkl <linux@xxxxxxxxxxxxxxxx> wrote: > > > +static struct input_dev *ps_sensors_create(struct hid_device *hdev, int accel_range, int accel_res, > > + int gyro_range, int gyro_res) > > +{ > > + struct input_dev *sensors; > > + int ret; > > + > > + sensors = ps_allocate_input_dev(hdev, "Motion Sensors"); > > + if (IS_ERR(sensors)) > > + return ERR_PTR(-ENOMEM); > > + > > + __set_bit(INPUT_PROP_ACCELEROMETER, sensors->propbit); > > + > > + /* Accelerometer */ > > + input_set_abs_params(sensors, ABS_X, -accel_range, accel_range, 16, 0); > > + input_set_abs_params(sensors, ABS_Y, -accel_range, accel_range, 16, 0); > > + input_set_abs_params(sensors, ABS_Z, -accel_range, accel_range, 16, 0); > > + input_abs_set_res(sensors, ABS_X, accel_res); > > + input_abs_set_res(sensors, ABS_Y, accel_res); > > + input_abs_set_res(sensors, ABS_Z, accel_res); > > + > > + /* Gyroscope */ > > + input_set_abs_params(sensors, ABS_RX, -gyro_range, gyro_range, 16, 0); > > + input_set_abs_params(sensors, ABS_RY, -gyro_range, gyro_range, 16, 0); > > + input_set_abs_params(sensors, ABS_RZ, -gyro_range, gyro_range, 16, 0); > > + input_abs_set_res(sensors, ABS_RX, gyro_res); > > + input_abs_set_res(sensors, ABS_RY, gyro_res); > > + input_abs_set_res(sensors, ABS_RZ, gyro_res); > > + > > + ret = input_register_device(sensors); > > + if (ret) > > + return ERR_PTR(ret); > > + > > + return sensors; > > +} > > The bits for EV_MSC/MSC_TIMESTAMP events are not set here, hence > timestamp events would not delivered: > > __set_bit(EV_MSC, sensors->evbit); > __set_bit(MSC_TIMESTAMP, sensors->mscbit); I don't know how I missed this... I remember adding it, but nope apparently not :( > > static int dualsense_get_mac_address(struct dualsense *ds) > > { > > uint8_t *buf; > > @@ -319,6 +469,7 @@ static int dualsense_parse_report(struct ps_device *ps_dev, struct hid_report *r > > struct dualsense_input_report *ds_report; > > uint8_t battery_data, battery_capacity, charging_status, value; > > int battery_status; > > + uint16_t sensor_timestamp; > > This uint16_t variable overflows just after a few events. Since the > timestamp from the controller is 32bit and the event value too, I assume > this should be too. Agreed. > > -- > Florian Märkl > https://metallic.software Regards, Roderick