diff mbox

hid: hid-sensor-prox: Add more data field for hysteresis parsing

Message ID 1486979692-44878-1-git-send-email-hongyan.song@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Song, Hongyan Feb. 13, 2017, 9:54 a.m. UTC
Add HID_USAGE_SENSOR_HUMAN_PRESENCE support for Human Presence sensitivity
parsing, in case some implementation uses it as sensitivity modifier.

Signed-off-by: Song Hongyan <hongyan.song@intel.com>
---
 drivers/iio/light/hid-sensor-prox.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Jonathan Cameron Feb. 19, 2017, 11:50 a.m. UTC | #1
On 13/02/17 09:54, Song Hongyan wrote:
> Add HID_USAGE_SENSOR_HUMAN_PRESENCE support for Human Presence sensitivity
> parsing, in case some implementation uses it as sensitivity modifier.
> 
> Signed-off-by: Song Hongyan <hongyan.song@intel.com>
Do we want to perhaps indicate to userspace in some way that this is what is being
reported? (not that I have any idea how a proximity sensor could potentially tell
a human from a passing cat for example ;)

Otherwise, I'm fine with this but would like an Ack from Srinivas.
> ---
>  drivers/iio/light/hid-sensor-prox.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/iio/light/hid-sensor-prox.c b/drivers/iio/light/hid-sensor-prox.c
> index 45ca056..73fced8 100644
> --- a/drivers/iio/light/hid-sensor-prox.c
> +++ b/drivers/iio/light/hid-sensor-prox.c
> @@ -240,6 +240,13 @@ static int prox_parse_report(struct platform_device *pdev,
>  			st->common_attributes.sensitivity.index,
>  			st->common_attributes.sensitivity.report_id);
>  	}
> +	if (st->common_attributes.sensitivity.index < 0)
> +		sensor_hub_input_get_attribute_info(hsdev,
> +			HID_FEATURE_REPORT, usage_id,
> +			HID_USAGE_SENSOR_DATA_MOD_CHANGE_SENSITIVITY_ABS |
> +			HID_USAGE_SENSOR_HUMAN_PRESENCE,
> +			&st->common_attributes.sensitivity);
> +
>  	return ret;
>  }
>  
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Pandruvada, Srinivas Feb. 21, 2017, 10:30 a.m. UTC | #2
On Sun, 2017-02-19 at 11:50 +0000, Jonathan Cameron wrote:
> On 13/02/17 09:54, Song Hongyan wrote:

> > Add HID_USAGE_SENSOR_HUMAN_PRESENCE support for Human Presence

> > sensitivity

> > parsing, in case some implementation uses it as sensitivity

> > modifier.

> > 

> > Signed-off-by: Song Hongyan <hongyan.song@intel.com>

Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>


> 

> Do we want to perhaps indicate to userspace in some way that this is

> what is being

> reported? (not that I have any idea how a proximity sensor could

> potentially tell

> a human from a passing cat for example ;)

> 

> Otherwise, I'm fine with this but would like an Ack from Srinivas.

> > ---

> >  drivers/iio/light/hid-sensor-prox.c | 7 +++++++

> >  1 file changed, 7 insertions(+)

> > 

> > diff --git a/drivers/iio/light/hid-sensor-prox.c

> > b/drivers/iio/light/hid-sensor-prox.c

> > index 45ca056..73fced8 100644

> > --- a/drivers/iio/light/hid-sensor-prox.c

> > +++ b/drivers/iio/light/hid-sensor-prox.c

> > @@ -240,6 +240,13 @@ static int prox_parse_report(struct

> > platform_device *pdev,

> >  			st->common_attributes.sensitivity.index,

> >  			st-

> > >common_attributes.sensitivity.report_id);

> >  	}

> > +	if (st->common_attributes.sensitivity.index < 0)

> > +		sensor_hub_input_get_attribute_info(hsdev,

> > +			HID_FEATURE_REPORT, usage_id,

> > +			HID_USAGE_SENSOR_DATA_MOD_CHANGE_SENSITIVI

> > TY_ABS |

> > +			HID_USAGE_SENSOR_HUMAN_PRESENCE,

> > +			&st->common_attributes.sensitivity);

> > +

> >  	return ret;

> >  }

> >  

> > 

> 

>
diff mbox

Patch

diff --git a/drivers/iio/light/hid-sensor-prox.c b/drivers/iio/light/hid-sensor-prox.c
index 45ca056..73fced8 100644
--- a/drivers/iio/light/hid-sensor-prox.c
+++ b/drivers/iio/light/hid-sensor-prox.c
@@ -240,6 +240,13 @@  static int prox_parse_report(struct platform_device *pdev,
 			st->common_attributes.sensitivity.index,
 			st->common_attributes.sensitivity.report_id);
 	}
+	if (st->common_attributes.sensitivity.index < 0)
+		sensor_hub_input_get_attribute_info(hsdev,
+			HID_FEATURE_REPORT, usage_id,
+			HID_USAGE_SENSOR_DATA_MOD_CHANGE_SENSITIVITY_ABS |
+			HID_USAGE_SENSOR_HUMAN_PRESENCE,
+			&st->common_attributes.sensitivity);
+
 	return ret;
 }