Skip to contentSkip to conversation

input question: ambient light sensor button

DISCUSSION Applied Pali Rohár 4 participants 9 messages Sep 15, 2013 – Nov 26, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hello,

I do not know where to ask this question, but I think that kernel developers could help me.

I have notebook with one special button on keyboard which is designed for turning ambient light sensor on and off. By default pressing button do nothing (I can turn ambient light sensor on/off via sysfs platform wmi module). Button press is reported by kernel input device AT Translated Set 2 keyboard and reports it as button "touchpad off".

Of course "touchpad off" is incorrect and I'd like to ask which kernel key or button from /usr/include/linux/input.h should be mapped for my ambient light sensor button? Is there already some? And what is strategy for allocating KEY_* and BTN_* numbers?

I'd like to know this, so udev could have correct DMI keymap hooks and other userspace programs can understand ambient light sensor button correctly.

Signature · 2 lines
Pali Rohár
[email protected]
#1 lore raw
Quoted 10 lines · Pali Rohár

I do not know where to ask this question, but I think that kernel developers could help me.

I have notebook with one special button on keyboard which is designed for turning ambient light sensor on and off. By default pressing button do nothing (I can turn ambient light sensor on/off via sysfs platform wmi module). Button press is reported by kernel input device AT Translated Set 2 keyboard and reports it as button "touchpad off".

Quoted 4 lines

Of course "touchpad off" is incorrect and I'd like to ask which kernel key or button from /usr/include/linux/input.h should be mapped for my ambient light sensor button? Is there already some? And what is strategy for allocating KEY_* and BTN_* numbers?

This is maintained by Dmitry, so he's the one to answer this. I am adding him to CC.

Quoted 3 lines

I'd like to know this, so udev could have correct DMI keymap hooks and other userspace programs can understand ambient light sensor button correctly.

Signature · 6 lines
Jiri Kosina
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
maintainer
#2 lore raw
Quoted 12 lines · Jiri Kosina
Quoted 10 lines · Pali Rohár

I do not know where to ask this question, but I think that kernel developers could help me.

I have notebook with one special button on keyboard which is designed for turning ambient light sensor on and off. By default pressing button do nothing (I can turn ambient light sensor on/off via sysfs platform wmi module). Button press is reported by kernel input device AT Translated Set 2 keyboard and reports it as button "touchpad off".

Quoted 7 lines
Quoted 4 lines

Of course "touchpad off" is incorrect and I'd like to ask which kernel key or button from /usr/include/linux/input.h should be mapped for my ambient light sensor button? Is there already some? And what is strategy for allocating KEY_* and BTN_* numbers?

This is maintained by Dmitry, so he's the one to answer this. I am adding him to CC.

I guess we need patch adding

	#define KEY_ALS_TOGGLE	0x230

Thanks.

Signature · 5 lines
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#3 lore raw
Quoted 19 lines · On Wednesday 13 November 2013 17:28:40 Dmitry Torokhov wrote:
Quoted 18 lines · Jiri Kosina
Quoted 16 lines · Pali Rohár

I do not know where to ask this question, but I think that kernel developers could help me.

I have notebook with one special button on keyboard which is designed for turning ambient light sensor on and off. By default pressing button do nothing (I can turn ambient light sensor on/off via sysfs platform wmi module). Button press is reported by kernel input device AT Translated Set 2 keyboard and reports it as button "touchpad off".

Of course "touchpad off" is incorrect and I'd like to ask which kernel key or button from /usr/include/linux/input.h should be mapped for my ambient light sensor button? Is there already some? And what is strategy for allocating KEY_* and BTN_* numbers?

Quoted 8 lines
Quoted 2 lines

This is maintained by Dmitry, so he's the one to answer this. I am adding him to CC.

I guess we need patch adding

	#define KEY_ALS_TOGGLE	0x230

Thanks.

So there is no good key for als yet?

Signature · 2 lines
Pali Rohár
[email protected]
maintainer
#4 lore raw
Quoted 23 lines · Pali Rohár
Quoted 22 lines · On Wednesday 13 November 2013 17:28:40 Dmitry Torokhov wrote:
Quoted 20 lines · Jiri Kosina
Quoted 11 lines · Pali Rohár

I do not know where to ask this question, but I think that kernel developers could help me.

I have notebook with one special button on keyboard which is designed for turning ambient light sensor on and off. By default pressing button do nothing (I can turn ambient light sensor on/off via sysfs platform wmi module). Button press is reported by kernel input device AT Translated Set 2 keyboard and reports it as button "touchpad off".

Quoted 5 lines

Of course "touchpad off" is incorrect and I'd like to ask which kernel key or button from /usr/include/linux/input.h should be mapped for my ambient light sensor button? Is there already some? And what is strategy for allocating KEY_* and BTN_* numbers?

This is maintained by Dmitry, so he's the one to answer this. I am adding him to CC.

Quoted 7 lines
Quoted 5 lines

I guess we need patch adding

	#define KEY_ALS_TOGGLE	0x230

Thanks.

So there is no good key for als yet?

No, but if you send me a patch adding it I will gladly apply it.

Thanks.

Signature · 1 line
Dmitry
#5 lore raw
Quoted 29 lines · On Tuesday 19 November 2013 22:27:36 Dmitry Torokhov wrote:
Quoted 28 lines · Pali Rohár
Quoted 27 lines · On Wednesday 13 November 2013 17:28:40 Dmitry Torokhov wrote:
Quoted 19 lines · Jiri Kosina
Quoted 11 lines · Pali Rohár

I do not know where to ask this question, but I think that kernel developers could help me.

I have notebook with one special button on keyboard which is designed for turning ambient light sensor on and off. By default pressing button do nothing (I can turn ambient light sensor on/off via sysfs platform wmi module). Button press is reported by kernel input device AT Translated Set 2 keyboard and reports it as button "touchpad off".

Quoted 6 lines

Of course "touchpad off" is incorrect and I'd like to ask which kernel key or button from /usr/include/linux/input.h should be mapped for my ambient light sensor button? Is there already some? And what is strategy for allocating KEY_* and BTN_* numbers?

Quoted 2 lines

This is maintained by Dmitry, so he's the one to answer this. I am adding him to CC.

I guess we need patch adding

	#define KEY_ALS_TOGGLE	0x230
Quoted 8 lines
Quoted 3 lines
Quoted 1 line

Thanks.

So there is no good key for als yet?

No, but if you send me a patch adding it I will gladly apply it.

Thanks.

Ok, here is patch:

Add key code for ambient light sensor button

More notebooks have special button for enabling/disabling ambient light sensor. This patch adding new als code to input.h header file.

include/uapi/linux/input.h +2 -0
index a372627..1562f10 100644
@@ -719,6 +719,8 @@ struct input_keymap_entry {
 #define BTN_DPAD_LEFT		0x222
 #define BTN_DPAD_RIGHT		0x223
 
+#define KEY_ALS_TOGGLE		0x230
+
 #define BTN_TRIGGER_HAPPY		0x2c0
 #define BTN_TRIGGER_HAPPY1		0x2c0
 #define BTN_TRIGGER_HAPPY2		0x2c1
Signature · 2 lines
Pali Rohár
[email protected]
#6 lore raw

Hi,

Quoted 27 lines · Pali Rohár
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

I guess we need patch adding

  #define KEY_ALS_TOGGLE  0x230
Quoted 8 lines
Quoted 3 lines
Quoted 1 line

Thanks.

So there is no good key for als yet?

No, but if you send me a patch adding it I will gladly apply it.

Thanks.

Ok, here is patch:

Add key code for ambient light sensor button

More notebooks have special button for enabling/disabling ambient light sensor. This patch adding new als code to input.h header file.

include/uapi/linux/input.h +0 -0
index a372627..1562f10 100644

include/uapi/linux/input.h struct input_keymap_entry { · line 722

Quoted 4 lines
include/uapi/linux/input.h +1 -0
@@ -719,6 +719,8 @@ struct input_keymap_entry {
 #define BTN_DPAD_LEFT          0x222
 #define BTN_DPAD_RIGHT         0x223
 
+#define KEY_ALS_TOGGLE         0x230

Could you just add a comment explaining that ALS is ambiant light sensor? Otherwise, I'm sure someone else will use this event code for an other thing... :)

Cheers,
Benjamin

#7 lore raw
Quoted 35 lines · On Wednesday 20 November 2013 16:59:42 Benjamin Tissoires wrote:

Hi,

Quoted 32 lines · Pali Rohár
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

I guess we need patch adding

  #define KEY_ALS_TOGGLE  0x230
Quoted 8 lines
Quoted 3 lines
Quoted 1 line

Thanks.

So there is no good key for als yet?

No, but if you send me a patch adding it I will gladly apply it.

Thanks.

Ok, here is patch:

Add key code for ambient light sensor button

More notebooks have special button for enabling/disabling ambient light sensor. This patch adding new als code to input.h header file.

(quoted diff) +0 -0

b/include/uapi/linux/input.h index a372627..1562f10 100644

include/uapi/linux/input.h +0 -0
@@ -719,6 +719,8 @@ struct input_keymap_entry {
 
 #define BTN_DPAD_LEFT          0x222
 #define BTN_DPAD_RIGHT         0x223
 
Quoted 8 lines

include/uapi/linux/input.h struct input_keymap_entry { · line 723

Quoted 1 line
include/uapi/linux/input.h +1 -0
+#define KEY_ALS_TOGGLE         0x230

Could you just add a comment explaining that ALS is ambiant light sensor? Otherwise, I'm sure someone else will use this event code for an other thing... :)

Cheers,
Benjamin

Ok, here is new diff with comment:

include/uapi/linux/input.h +2 -0
index a372627..7bacdb5 100644
@@ -719,6 +719,8 @@ struct input_keymap_entry {
 #define BTN_DPAD_LEFT		0x222
 #define BTN_DPAD_RIGHT		0x223
 
+#define KEY_ALS_TOGGLE		0x230	/* Ambient light sensor */
+
 #define BTN_TRIGGER_HAPPY		0x2c0
 #define BTN_TRIGGER_HAPPY1		0x2c0
 #define BTN_TRIGGER_HAPPY2		0x2c1
Signature · 2 lines
Pali Rohár
[email protected]
maintainer Applied
#8 lore raw
Quoted 42 lines · Pali Rohár
Quoted 41 lines · On Wednesday 20 November 2013 16:59:42 Benjamin Tissoires wrote:

Hi,

Quoted 28 lines · Pali Rohár
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

I guess we need patch adding

  #define KEY_ALS_TOGGLE  0x230
Quoted 8 lines
Quoted 3 lines
Quoted 1 line

Thanks.

So there is no good key for als yet?

No, but if you send me a patch adding it I will gladly apply it.

Thanks.

Ok, here is patch:

Add key code for ambient light sensor button

More notebooks have special button for enabling/disabling ambient light sensor. This patch adding new als code to input.h header file.

(quoted diff) +0 -0

b/include/uapi/linux/input.h index a372627..1562f10 100644

include/uapi/linux/input.h struct input_keymap_entry { · line 723

Quoted 5 lines
include/uapi/linux/input.h +1 -0
@@ -719,6 +719,8 @@ struct input_keymap_entry {
 
 #define BTN_DPAD_LEFT          0x222
 #define BTN_DPAD_RIGHT         0x223
 
+#define KEY_ALS_TOGGLE         0x230

Could you just add a comment explaining that ALS is ambiant light sensor? Otherwise, I'm sure someone else will use this event code for an other thing... :)

Quoted 4 lines
Quoted 2 lines

Cheers,
Benjamin

Ok, here is new diff with comment:

Applied, thank you.

Quoted 19 lines
include/uapi/linux/input.h +2 -0
index a372627..7bacdb5 100644
@@ -719,6 +719,8 @@ struct input_keymap_entry {
 #define BTN_DPAD_LEFT		0x222
 #define BTN_DPAD_RIGHT		0x223
 
+#define KEY_ALS_TOGGLE		0x230	/* Ambient light sensor */
+
 #define BTN_TRIGGER_HAPPY		0x2c0
 #define BTN_TRIGGER_HAPPY1		0x2c0
 #define BTN_TRIGGER_HAPPY2		0x2c1
Signature · 3 lines
-- 
Pali Rohár
[email protected]
Signature · 5 lines
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html