Query Regarding HID input Report Descriptor

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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_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(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_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_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_ACCELERATION,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_ACCELERATION,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_ACCELERATION,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.

Thanks 
Nehal Shah






[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux