Hi All On 6/10/2019 7:30 PM, Shah, Nehal-bakulchandra wrote: > Hi Srinivias > > On 5/18/2019 12:23 AM, Srinivas Pandruvada wrote: >> [CAUTION: External Email] >> >> Hi Nehal, >> >> On Fri, 2019-05-17 at 17:46 +0000, Shah, Nehal-bakulchandra wrote: >>> Hi Srinivas, >>> >>> On 5/17/2019 11:09 PM, Srinivas Pandruvada wrote: >>>> [CAUTION: External Email] >>>> >>>> On Wed, 2019-05-15 at 16:28 +0000, Shah, Nehal-bakulchandra wrote: >>>>> Hi All, >>>>> >>>>> >>>>> I am working on sensor driver for AMD platform and in our >>>>> platform, >>>>> firmware doesn't give data in HID format. So i am writing >>>>> interface >>>>> driver which makes >>>>> firmware data into HID Report format.Now i have taken reference >>>>> from >>>>> HID Usage document and i have created sample descriptor like this >>>>> for >>>>> accel 3d. >>>>> >>>>> static const u8 HID_Sensor_ReportDesc_acc[]= >>>>> { >>>>> HID_USAGE_PAGE_SENSOR, >>>>> HID_USAGE_SENSOR_TYPE_MOTION_ACCELEROMETER_3D, >>>>> HID_COLLECTION(Physical), >>>>> >>>>> //feature reports (xmit/receive) >>>>> HID_REPORT_ID(1), >>>>> HID_USAGE_PAGE_SENSOR, >>>>> HID_USAGE_SENSOR_PROPERTY_SENSOR_CONNECTION_TYPE, // NAry >>>>> HID_LOGICAL_MIN_8(0), >>>>> HID_LOGICAL_MAX_8(2), >>>>> HID_REPORT_SIZE(8), >>>>> HID_REPORT_COUNT(1), >>>>> HID_COLLECTION(Logical), >>>>> HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_INTEGRATED_SEL >>>>> , >>>>> HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_ATTACHED_SEL, >>>>> HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_EXTERNAL_SEL, >>>>> HID_FEATURE(Data_Arr_Abs), >>>>> HID_END_COLLECTION, >>>>> HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE, >>>>> HID_LOGICAL_MIN_8(0), >>>>> HID_LOGICAL_MAX_8(5), >>>>> HID_REPORT_SIZE(8), >>>>> HID_REPORT_COUNT(1), >>>>> HID_COLLECTION(Logical), >>>>> HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_NO_EVENTS_SEL, >>>>> HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_ALL_EVENTS_SEL, >>>>> HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_THRESHOLD_EVENTS_ >>>>> SEL, >>>>> HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_NO_EVENTS_WAKE_SE >>>>> L, >>>>> HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_ALL_EVENTS_WAKE_S >>>>> EL, >>>>> HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_THRESHOLD_EVENTS_ >>>>> WAKE >>>>> _SEL, >>>>> HID_FEATURE(Data_Arr_Abs), >>>>> HID_END_COLLECTION, >>>>> HID_USAGE_SENSOR_PROPERTY_POWER_STATE, >>>>> HID_LOGICAL_MIN_8(0), >>>>> HID_LOGICAL_MAX_8(5), >>>>> HID_REPORT_SIZE(8), >>>>> HID_REPORT_COUNT(1), >>>>> HID_COLLECTION(Logical), >>>>> HID_USAGE_SENSOR_PROPERTY_POWER_STATE_UNDEFINED_SEL, >>>>> HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D0_FULL_POWER_SEL, >>>>> HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D1_LOW_POWER_SEL, >>>>> HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D2_STANDBY_WITH_WAKE_ >>>>> SEL, >>>>> HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D3_SLEEP_WITH_WAKE_SE >>>>> L, >>>>> HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D4_POWER_OFF_SEL, >>>>> HID_FEATURE(Data_Arr_Abs), >>>>> HID_END_COLLECTION, >>>>> HID_USAGE_SENSOR_STATE, >>>>> HID_LOGICAL_MIN_8(0), >>>>> HID_LOGICAL_MAX_8(6), >>>>> HID_REPORT_SIZE(8), >>>>> HID_REPORT_COUNT(1), >>>>> HID_COLLECTION(Logical), >>>>> HID_USAGE_SENSOR_STATE_UNKNOWN_SEL, >>>>> HID_USAGE_SENSOR_STATE_READY_SEL, >>>>> HID_USAGE_SENSOR_STATE_NOT_AVAILABLE_SEL, >>>>> HID_USAGE_SENSOR_STATE_NO_DATA_SEL, >>>>> HID_USAGE_SENSOR_STATE_INITIALIZING_SEL, >>>>> HID_USAGE_SENSOR_STATE_ACCESS_DENIED_SEL, >>>>> HID_USAGE_SENSOR_STATE_ERROR_SEL, >>>>> HID_FEATURE(Data_Arr_Abs), >>>>> HID_END_COLLECTION, >>>>> HID_USAGE_SENSOR_PROPERTY_REPORT_INTERVAL, >>>>> HID_LOGICAL_MIN_8(0), >>>>> HID_LOGICAL_MAX_32(0xFF,0xFF,0xFF,0xFF), >>>>> HID_REPORT_SIZE(32), >>>>> HID_REPORT_COUNT(1), >>>>> HID_UNIT_EXPONENT(0), >>>>> HID_FEATURE(Data_Var_Abs), >>>>> HID_USAGE_SENSOR_DATA(HID_USAGE_SENSOR_DATA_MOTION_ACCELERA >>>>> TION >>>>> ,HID_USAGE_SENSOR_DATA_MOD_CHANGE_SENSITIVITY_ABS), >>>>> HID_LOGICAL_MIN_8(0), >>>>> HID_LOGICAL_MAX_16(0xFF,0xFF), >>>>> HID_REPORT_SIZE(16), >>>>> HID_REPORT_COUNT(1), >>>>> HID_UNIT_EXPONENT(0x0E), // scale default unit "G" to >>>>> provide >>>>> 2 digits past the decimal point >>>>> HID_FEATURE(Data_Var_Abs), >>>>> HID_USAGE_SENSOR_DATA(HID_USAGE_SENSOR_DATA_MOTION_ACCELERA >>>>> TION >>>>> ,HID_USAGE_SENSOR_DATA_MOD_MAX), >>>>> HID_LOGICAL_MIN_16(0x01,0x80), // LOGICAL_MINIMUM (- >>>>> 32767) >>>>> HID_LOGICAL_MAX_16(0xFF,0x7F), // LOGICAL_MAXIMUM >>>>> (32767) >>>>> HID_REPORT_SIZE(16), >>>>> HID_REPORT_COUNT(1), >>>>> HID_UNIT_EXPONENT(0x0E), // scale default unit "G" to >>>>> provide >>>>> 2 digits past the decimal point >>>>> HID_FEATURE(Data_Var_Abs), >>>>> HID_USAGE_SENSOR_DATA(HID_USAGE_SENSOR_DATA_MOTION_ACCELERA >>>>> TION >>>>> ,HID_USAGE_SENSOR_DATA_MOD_MIN), >>>>> HID_LOGICAL_MIN_16(0x01,0x80), // LOGICAL_MINIMUM (- >>>>> 32767) >>>>> HID_LOGICAL_MAX_16(0xFF,0x7F), // LOGICAL_MAXIMUM >>>>> (32767) >>>>> HID_REPORT_SIZE(16), >>>>> HID_REPORT_COUNT(1), >>>>> HID_UNIT_EXPONENT(0x0E), // scale default unit "G" to >>>>> provide >>>>> 2 digits past the decimal point >>>>> HID_FEATURE(Data_Var_Abs), >>>>> >>>>> //input reports (transmit) >>>>> HID_USAGE_PAGE_SENSOR, >>>>> HID_USAGE_SENSOR_STATE, >>>>> HID_LOGICAL_MIN_8(0), >>>>> HID_LOGICAL_MAX_8(6), >>>>> HID_REPORT_SIZE(8), >>>>> HID_REPORT_COUNT(1), >>>>> HID_COLLECTION(Logical), >>>>> HID_USAGE_SENSOR_STATE_UNKNOWN_SEL, >>>>> HID_USAGE_SENSOR_STATE_READY_SEL, >>>>> HID_USAGE_SENSOR_STATE_NOT_AVAILABLE_SEL, >>>>> HID_USAGE_SENSOR_STATE_NO_DATA_SEL, >>>>> HID_USAGE_SENSOR_STATE_INITIALIZING_SEL, >>>>> HID_USAGE_SENSOR_STATE_ACCESS_DENIED_SEL, >>>>> HID_USAGE_SENSOR_STATE_ERROR_SEL, >>>>> HID_INPUT(Data_Arr_Abs), >>>>> HID_END_COLLECTION, >>>>> HID_USAGE_SENSOR_EVENT, >>>>> HID_LOGICAL_MIN_8(0), >>>>> HID_LOGICAL_MAX_8(5), >>>>> HID_REPORT_SIZE(8), >>>>> HID_REPORT_COUNT(1), >>>>> HID_COLLECTION(Logical), >>>>> HID_USAGE_SENSOR_EVENT_UNKNOWN_SEL, >>>>> HID_USAGE_SENSOR_EVENT_STATE_CHANGED_SEL, >>>>> HID_USAGE_SENSOR_EVENT_PROPERTY_CHANGED_SEL, >>>>> HID_USAGE_SENSOR_EVENT_DATA_UPDATED_SEL, >>>>> HID_USAGE_SENSOR_EVENT_POLL_RESPONSE_SEL, >>>>> HID_USAGE_SENSOR_EVENT_CHANGE_SENSITIVITY_SEL, >>>>> HID_INPUT(Data_Arr_Abs), >>>>> HID_END_COLLECTION, >>>>> HID_USAGE_SENSOR_DATA_MOTION_ACCELERATION_X_AXIS, >>>>> HID_LOGICAL_MIN_16(0x01,0x80), // LOGICAL_MINIMUM (- >>>>> 32767) >>>>> HID_LOGICAL_MAX_16(0xFF,0x7F), // LOGICAL_MAXIMUM >>>>> (32767) >>>>> HID_REPORT_SIZE(16), >>>>> HID_REPORT_COUNT(1), >>>>> HID_UNIT_EXPONENT(0x0E), // scale default unit "G" to >>>>> provide >>>>> 2 digits past the decimal point >>>>> HID_INPUT(Data_Var_Abs), >>>>> HID_USAGE_SENSOR_DATA_MOTION_ACCELERATION_Y_AXIS, >>>>> HID_LOGICAL_MIN_16(0x01,0x80), // LOGICAL_MINIMUM (- >>>>> 32767) >>>>> HID_LOGICAL_MAX_16(0xFF,0x7F), // LOGICAL_MAXIMUM >>>>> (32767) >>>>> HID_REPORT_SIZE(16), >>>>> HID_REPORT_COUNT(1), >>>>> HID_UNIT_EXPONENT(0x0E), // scale default unit "G" to >>>>> provide >>>>> 2 digits past the decimal point >>>>> HID_INPUT(Data_Var_Abs), >>>>> HID_USAGE_SENSOR_DATA_MOTION_ACCELERATION_Z_AXIS, >>>>> HID_LOGICAL_MIN_16(0x01,0x80), // LOGICAL_MINIMUM (- >>>>> 32767) >>>>> HID_LOGICAL_MAX_16(0xFF,0x7F), // LOGICAL_MAXIMUM >>>>> (32767) >>>>> HID_REPORT_SIZE(16), >>>>> HID_REPORT_COUNT(1), >>>>> HID_UNIT_EXPONENT(0x0E), // scale default unit "G" to >>>>> provide >>>>> 2 digits past the decimal point >>>>> HID_INPUT(Data_Var_Abs), >>>>> >>>>> //include the following datafield if required to support >>>>> the >>>>> shake event >>>>> HID_USAGE_SENSOR_DATA_MOTION_STATE, >>>>> HID_LOGICAL_MIN_8(0), // False = Still >>>>> HID_LOGICAL_MAX_8(1), // True = In Motion >>>>> HID_REPORT_SIZE(8), >>>>> HID_REPORT_COUNT(1), >>>>> HID_INPUT(Data_Var_Abs), >>>>> >>>>> HID_END_COLLECTION >>>>> }; >>>>> >>>>> for Feature report i have created following structure >>>>> >>>>> struct accel3_feature_report >>>>> { >>>>> //common properties >>>>> u8 reportid; >>>>> >>>>> u8 connectiontype; >>>>> u8 reportstate; >>>>> u8 powerstate; >>>>> u8 sensorstate; >>>>> u32 reportinterval; >>>>> >>>>> //properties specific to this sensor >>>>> u16 accelsensitiity; >>>>> u16 accelmax; >>>>> u16 accelmin; >>>>> >>>>> } ; >>>>> >>>>> Can some one help me is this the correct way of going forward? >>>>> With >>>>> this i am getting request for feature report and i can see device >>>>> in >>>>> iio bus also but i am not getting call for input report. Please >>>>> help >>>>> me in this regards. >>>> >>>> You will get call for input report when you try to read. >>>> >>>> For example: >>>> #cat in_accel_*_raw >>>> >>>> Thanks, >>>> Srinivas >>>> >>>> >>> >>> Yes today i could get the input report after running above command. >>> So i have question, like in some external sensor hub i have observed >>> that sensor is pushing data to HID Framework and iio-proxy keeps >>> getting updated. But here we need to run the above command and after >>> that iio-proxy is getting updated. Is it the same case in ISH and >>> other design? >> There are two modes in IIO: >> - The raw mode: which is by user doing "cat" >> - The other is read via buffers. In this mode, you enable some channels >> from iio. Here the ISH or usb/i2c-sensor-hub will push the data via >> hid, so that user mode can read data via iio buffers. In this case your >> hub should be able to process the report_interval, report/power state, >> sensitivity etc. Basically when hub notice change in the data it can >> push the data to hid. Here hid core will cause notify function to be >> called with data. >> >> Thanks, >> Srinivas >> >> >>>>> >>>>> Thanks >>>>> Nehal Shah >>>>> >>>>> >>> >>> Regards >>> Nehal Shah >> > Thanks for all help.Now i am able to get data > properly. Howerver as i understood none of the > data is coming in float and there is no support of > float but my understand says that most of the > sensor data should be in float . can you explain > this please? > > regards > Nehal Shah > can you suggest the application to test the different sensors? With IIo-Proxy we are able to validate only ambient and accel sensor, however for gyro i can see support in IIO-Proxy but i dont know how to validate it? As of now 1 .I would like to validate compass,gyro,accel and ambient sensors. 2. How the tablet/book mode can be achieved ? Your inputs will be much more appreciated. Regards Nehal Shah