none
Custom sensor values not being detected correctly by SDT(Sensor Diagnostics tool) RRS feed

  • Question

  • I am trying to implement a custom sensor(in firmware), when i give logical max=32767,logical min=-32767, and unit exponent(0) for custom value_1 In report descriptor, SDT says out of bound when i pass -1 (0XFFFF).

    Now with the same descriptor when I pass unit exponent(0x0f), i get correctly with a factor of 1/10, that is when i pass -1(0xFFFF),it detects -0.1, if i pass -4000, SDT detects -400.0

    So could anyone please clarify why SDT is able to pick 0XFFFF as a negative value when i give an unit exponent  value of 0x0F and why SDT is detecting 0xFFFF as 65536 when i give unit exponent as 0x00?

    Wednesday, October 9, 2013 10:27 AM

Answers

  • Section 4.2.1 is generalized, while custom data field values are restricted to unsigned integer (VT_UI4) or float (VT_R4). This is documented in Table 17 for each custom data field value. So unsigned int vs. float is determined strictly by the units exponent being equal to zero or not.

    Here is the entry for Custom Value 1 in table 17 with some details removed for brevity. Hope that helps clarify things.

    Custom Value 1

    0x0544

    HID_USAGE_SENSOR_DATA_CUSTOM_VALUE_1

    8-bit, 16-bit or 32-bit unsigned integer value or 16-bit or 32-bit fixed point value. See section 4.2.1 for use of integer and fixed-point values

    Type = VT_UI4 or VT_R4


    This posting is provided AS IS with no warranties, and confers no rights.

    • Marked as answer by ArMD Wednesday, October 9, 2013 7:16 PM
    Wednesday, October 9, 2013 7:13 PM
  • Custom data field values are treated as either unsigned integers (VT_UI4) or floating point (VT_R4) depending on the unit exponent. For a unit exponent of zero, as used in your example, the sensor stack assumes 0xFFFF represents a 16-bit unsigned value. Special care must be taken not to specify a logical min < 0 for custom data field values with a unit exponent of zero. For additional details see Table 17: Custom Sensor Field Usages and Section 4.2.1: Values, Types, and Unit Exponents in the HID Sensor Usages whitepaper (http://msdn.microsoft.com/en-us/library/windows/hardware/hh975383.aspx).

    Andrew


    This posting is provided AS IS with no warranties, and confers no rights.

    Wednesday, October 9, 2013 5:50 PM

All replies

  • Can you post the full report descriptor? What is usage type?

    This posting is provided "AS IS" with no warranties, and confers no rights.

    Wednesday, October 9, 2013 2:26 PM
  • It is sensor usage type and  sensor type other custom, and i am able to get data when unit exponent is 0x0F that's why the confusion came up.

    I am working on win8. Anyway putting up the custom sensor part here, i am passing enumeration and i even get positive values updated in SDT.

     HID_REPORT_ID(1),       
                     HID_USAGE_PAGE_SENSOR,
                     HID_USAGE_SENSOR_TYPE_OTHER_CUSTOM,   
                     HID_COLLECTION(Physical),    
                    /* Calib Feature report */
                         HID_USAGE_PAGE_SENSOR,
                         HID_USAGE_SENSOR_PROPERTY_SENSOR_CONNECTION_TYPE,
                             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_INTEGRATED_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_SEL,
                                 HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_ALL_EVENTS_WAKE_SEL,
                                 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(0x00),      
                             HID_LOGICAL_MAX_8(0x05),      
                             HID_REPORT_SIZE(0x08),        
                             HID_REPORT_COUNT(0x01),
                             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_SEL,
                                 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_16(0xFF, 0xFF),         //         Logical Maximum (-1)
                             HID_REPORT_SIZE(16),
                             HID_REPORT_COUNT(1),
                             HID_UNIT_EXPONENT(0),
                             HID_FEATURE(Data_Var_Abs),
                         HID_USAGE_SENSOR_DATA(HID_USAGE_SENSOR_DATA_CUSTOM_VALUE,HID_USAGE_SENSOR_DATA_MOD_ACCURACY),
                             HID_LOGICAL_MIN_8(0),
                             HID_LOGICAL_MAX_16(0x03, 0x00),         //         Logical Maximum (-1)
                             HID_REPORT_SIZE(16),
                             HID_REPORT_COUNT(1),
                             HID_UNIT_EXPONENT(0),         
                             HID_FEATURE(Data_Var_Abs),
                         HID_USAGE_SENSOR_DATA(HID_USAGE_SENSOR_DATA_CUSTOM_VALUE,HID_USAGE_SENSOR_DATA_MOD_RESOLUTION),
                             HID_LOGICAL_MIN_8(0),         
                             HID_LOGICAL_MAX_16(0x03, 0x00),         //         Logical Maximum (-1)
                             HID_REPORT_SIZE(16),
                             HID_REPORT_COUNT(1),
                             HID_UNIT_EXPONENT(0),         
                             HID_FEATURE(Data_Var_Abs),
                         HID_USAGE_SENSOR_DATA(HID_USAGE_SENSOR_DATA_CUSTOM_VALUE,HID_USAGE_SENSOR_DATA_MOD_CHANGE_SENSITIVITY_ABS),
                             HID_LOGICAL_MIN_8(0),
                             HID_LOGICAL_MAX_16(0xFF, 0xFF),         //         Logical Maximum (-1)
                             HID_REPORT_SIZE(16),
                             HID_REPORT_COUNT(1),
                             HID_UNIT_EXPONENT(0),         
                             HID_FEATURE(Data_Var_Abs),
                         HID_USAGE_SENSOR_DATA(HID_USAGE_SENSOR_DATA_CUSTOM_VALUE,HID_USAGE_SENSOR_DATA_MOD_MAX),
                             HID_LOGICAL_MIN_16(0x10, 0x80),         //         Logical Minimum (-32767)
                             HID_LOGICAL_MAX_16(0xFF, 0x7F),        
                             HID_REPORT_SIZE(16),
                             HID_REPORT_COUNT(1),
                             HID_UNIT_EXPONENT(0),                  
                             HID_FEATURE(Data_Var_Abs),
                         HID_USAGE_SENSOR_DATA(HID_USAGE_SENSOR_DATA_CUSTOM_VALUE,HID_USAGE_SENSOR_DATA_MOD_MIN),
                             HID_LOGICAL_MIN_16(0x10, 0x80),         //         Logical Minimum (-32767)
                             HID_LOGICAL_MAX_16(0xFF, 0x7F),        
                             HID_REPORT_SIZE(16),
                             HID_REPORT_COUNT(1),
                             HID_UNIT_EXPONENT(0),         
                             HID_FEATURE(Data_Var_Abs),    
                    /* Calib input report */
                         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_CUSTOM_VALUE_1,
                             HID_LOGICAL_MIN_16(0x10, 0x80),
                             HID_LOGICAL_MAX_16(0xFF, 0x7F),        
                             HID_REPORT_SIZE(16),
                             HID_REPORT_COUNT(1),
                             HID_UNIT_EXPONENT(0),
                             HID_INPUT(Data_Var_Abs),

                HID_END_COLLECTION,

    Wednesday, October 9, 2013 2:56 PM
  • Custom data field values are treated as either unsigned integers (VT_UI4) or floating point (VT_R4) depending on the unit exponent. For a unit exponent of zero, as used in your example, the sensor stack assumes 0xFFFF represents a 16-bit unsigned value. Special care must be taken not to specify a logical min < 0 for custom data field values with a unit exponent of zero. For additional details see Table 17: Custom Sensor Field Usages and Section 4.2.1: Values, Types, and Unit Exponents in the HID Sensor Usages whitepaper (http://msdn.microsoft.com/en-us/library/windows/hardware/hh975383.aspx).

    Andrew


    This posting is provided AS IS with no warranties, and confers no rights.

    Wednesday, October 9, 2013 5:50 PM
  • Thanks Andrew. I have been wasting a lot of time testing and retesting my descriptor for this.

    However I have a doubt, How does the host (Win 8 machine) differentiate between signed and unsigned?

    Following is from section 4.2.1,Sensor usages white paper

    "

    Unsigned Integer

    A value is identified as an unsigned integer when the ReportSize field = 8, 16 or 32 while the Units Exponent value = 0. In this section, this is expressed as HID_REPORT_SIZE(8), HID_REPORT_SIZE(16), or HID_REPORT_SIZE(32) respectively. Logical Minimum and Logical Maximum must both be positive values. Units can be specified or remain unspecified. Units Exponent must be = 0.

    Signed Integer

    A value is identified as a signed integer when the ReportSize field = 8, 16 or 32 while the Units Exponent value = 0. In this section, this is expressed as HID_REPORT_SIZE(8), HID_REPORT_SIZE(16), or HID_REPORT_SIZE(32) respectively. Logical Minimum must less than Logical Maximum. If Logical Minimum is = 0, the value of the field is treated as an unsigned number. If Logical Minimum > 0, care must be taken that the sign bit (MSb) is not = ‘1’ or the value will be treated as a negative number. Units can be specified or remain unspecified. Units Exponent must be = 0."


    Wednesday, October 9, 2013 7:06 PM
  • Section 4.2.1 is generalized, while custom data field values are restricted to unsigned integer (VT_UI4) or float (VT_R4). This is documented in Table 17 for each custom data field value. So unsigned int vs. float is determined strictly by the units exponent being equal to zero or not.

    Here is the entry for Custom Value 1 in table 17 with some details removed for brevity. Hope that helps clarify things.

    Custom Value 1

    0x0544

    HID_USAGE_SENSOR_DATA_CUSTOM_VALUE_1

    8-bit, 16-bit or 32-bit unsigned integer value or 16-bit or 32-bit fixed point value. See section 4.2.1 for use of integer and fixed-point values

    Type = VT_UI4 or VT_R4


    This posting is provided AS IS with no warranties, and confers no rights.

    • Marked as answer by ArMD Wednesday, October 9, 2013 7:16 PM
    Wednesday, October 9, 2013 7:13 PM

  • I missed the restriction for custom sensor.

    Thanks for pointing it out.

    Wednesday, October 9, 2013 7:16 PM