Re: ThinkPad Extra Buttons as /devices/platform/thinkpad_acpi/input/input16

2024-01-22 Thread David Wright
On Mon 22 Jan 2024 at 07:40:00 (+0100), Geert Stappers wrote:
> On Sun, Jan 21, 2024 at 04:34:23PM -0600, David Wright wrote:
> > On Sun 21 Jan 2024 at 22:41:01 (+0100), Geert Stappers wrote:
> > > Pressing "Function key with symbol of computer sending signal" has no
> > > effect. Which could be caused by the horrible state of keyboard.
> > > When keyboard is needed, is an USB-attached keyboard needed. Usual use
> > > case of the laptop is "headless server, server with SSH access".
> > 
> > I'm not sure what you mean by horrible state.
> 
> That the laptop has a worndown (usage damaged) keyboard. [1]
> 
> > > So I'm ask if 
> > >   export KEYCODE=42
> > >   echo $KEYCODE > /devices/platform/thinkpad_acpi/input/input16
> > > could cause "wlan radio enable"? Or should KEYCODE be another magic 
> > > number?
> > 
> > FWIW my wifi hardware button's keycode is 246.
> 
> How was that keycode found?

By running xev and pressing the button, which is on the front edge
of the laptop. Having the button there is really inconvenient, as
it's easy for a belt buckle or such to accidentally press it.
In theory, that should be easily noticed, as the button is translucent
and illuminated when wifi is connected (and flashes when attempting
to connect). However, the light is not consistent in behaviour.

But another suggestion comes from a more modern laptop, which has
an aeroplane Fn-key (action/hot key), and that uses 255.

So that's 246 / XF86WLAN   on an old laptop with a physical button,
and   255 / XF86RFKill on a newer laptop with a Fn-key.

[ … ]

> Back to "send key code".

One can but try. Did you check the BIOS, BTW?

$ xmodmap -pk or -pke will print what keycodes are available,
but I don't claim to know how all this stuff works (if it does).

Cheers,
David.



Re: ThinkPad Extra Buttons as /devices/platform/thinkpad_acpi/input/input16

2024-01-21 Thread Geert Stappers
On Sun, Jan 21, 2024 at 04:34:23PM -0600, David Wright wrote:
> On Sun 21 Jan 2024 at 22:41:01 (+0100), Geert Stappers wrote:
> > Pressing "Function key with symbol of computer sending signal" has no
> > effect. Which could be caused by the horrible state of keyboard.
> > When keyboard is needed, is an USB-attached keyboard needed. Usual use
> > case of the laptop is "headless server, server with SSH access".
> 
> I'm not sure what you mean by horrible state.

That the laptop has a worndown (usage damaged) keyboard. [1]

 
> > So I'm ask if 
> >   export KEYCODE=42
> >   echo $KEYCODE > /devices/platform/thinkpad_acpi/input/input16
> > could cause "wlan radio enable"? Or should KEYCODE be another magic number?
> 
> FWIW my wifi hardware button's keycode is 246.

How was that keycode found?

 
> But I would have thought the files to peruse might be:
> 
>   $ ls -GlgR /sys/class/rfkill/rfkill0/
>   /sys/class/rfkill/rfkill0/:
>   total 0
>   lrwxrwxrwx 10 Jan 21 16:13 device -> ../../phy0
>   -r--r--r-- 1 4096 Jan 21 16:13 hard
>   -r--r--r-- 1 4096 Jan 21 16:13 index
>   -r--r--r-- 1 4096 Jan 21 16:13 name
>   -r--r--r-- 1 4096 Jan 21 16:13 persistent
>   drwxr-xr-x 20 Jan 21 16:13 power
>   -rw-r--r-- 1 4096 Jan 21 16:13 soft
>   -rw-r--r-- 1 4096 Jan 21 16:13 state
>   lrwxrwxrwx 10 Jan 21 16:13 subsystem -> 
> ../../../../../../../class/rfkill
>   -r--r--r-- 1 4096 Jan 21 16:13 type
>   -rw-r--r-- 1 4096 Jan 21 16:13 uevent
> 
>   /sys/class/rfkill/rfkill0/power:
>   total 0
>   -rw-r--r-- 1 4096 Jan 21 16:14 async
>   -rw-r--r-- 1 4096 Jan 21 16:14 autosuspend_delay_ms
>   -rw-r--r-- 1 4096 Jan 21 16:14 control
>   -r--r--r-- 1 4096 Jan 21 16:14 runtime_active_kids
>   -r--r--r-- 1 4096 Jan 21 16:14 runtime_active_time
>   -r--r--r-- 1 4096 Jan 21 16:14 runtime_enabled
>   -r--r--r-- 1 4096 Jan 21 16:14 runtime_status
>   -r--r--r-- 1 4096 Jan 21 16:14 runtime_suspended_time
>   -r--r--r-- 1 4096 Jan 21 16:14 runtime_usage
>   $ 

Ah, nice.



root@nero:/sys/class/rfkill/rfkill2# ls
device  hard  index  name  persistent  power  soft  state  subsystem  type  
uevent
root@nero:/sys/class/rfkill/rfkill2# head *
==> device <==
head: error reading 'device': Is a directory

==> hard <==
1

==> index <==
2

==> name <==
phy0

==> persistent <==
0

==> power <==
head: error reading 'power': Is a directory

==> soft <==
0

==> state <==
2

==> subsystem <==
head: error reading 'subsystem': Is a directory

==> type <==
wlan

==> uevent <==
RFKILL_NAME=phy0
RFKILL_TYPE=wlan
RFKILL_STATE=2
root@nero:/sys/class/rfkill/rfkill2# echo 0 > hard
-bash: hard: Permission denied
root@nero:/sys/class/rfkill/rfkill2# echo 1 > soft
root@nero:/sys/class/rfkill/rfkill2# rfkill list 2
2: phy0: Wireless LAN
Soft blocked: yes
Hard blocked: yes
root@nero:/sys/class/rfkill/rfkill2# echo 0 > soft
root@nero:/sys/class/rfkill/rfkill2# rfkill list 2
2: phy0: Wireless LAN
Soft blocked: no
Hard blocked: yes
root@nero:/sys/class/rfkill/rfkill2# 



Almost there and then reached a dead end.


Back to "send key code".


 
> > What also would be helpfull, is knowning if 
> > 
> >   echo 4242 > /devics/platform/laptop_chipset/input/input17
> > 
> > could change brightness (or another visible effect)
> 
> Likewise:
> 
>   $ ls -GlgR /sys/class/backlight/intel_backlight/
  
>   $ 
> 
> A recent thread on that starts at:
> 
>   https://lists.debian.org/debian-user/2023/10/msg00621.html
> 
> with a nice algorithm in:
> 
>   https://lists.debian.org/debian-user/2023/10/msg00648.html
> 

Yes, nice. However the /sys/class/backlight/intel_backlight/
translates to the /sys/class/rfkill/rfkill2/ which has been explored.



> Cheers,
> David.
 

Groeten
Geert Stappers

[1] The "horrible state" was and is also "best days are over"
-- 
Silence is hard to parse



Re: ThinkPad Extra Buttons as /devices/platform/thinkpad_acpi/input/input16

2024-01-21 Thread Charles Curley
On Sun, 21 Jan 2024 22:41:01 +0100
Geert Stappers  wrote:

> Hoping that is it possible:
> 
> How to inject key stroke  or "button pressed" in
> /devices/platform/thinkpad_acpi/input/input16 ?

Thinkwiki might be useful. https://www.thinkwiki.org/wiki/ThinkWiki

-- 
Does anybody read signatures any more?

https://charlescurley.com
https://charlescurley.com/blog/



Re: ThinkPad Extra Buttons as /devices/platform/thinkpad_acpi/input/input16

2024-01-21 Thread David Wright
On Sun 21 Jan 2024 at 22:41:01 (+0100), Geert Stappers wrote:
> Pressing "Function key with symbol of computer sending signal" has no
> effect. Which could be caused by the horrible state of keyboard.
> When keyboard is needed, is an USB-attached keyboard needed. Usual use
> case of the laptop is "headless server, server with SSH access".

I'm not sure what you mean by horrible state.

> So I'm ask if 
>   export KEYCODE=42
>   echo $KEYCODE > /devices/platform/thinkpad_acpi/input/input16
> could cause "wlan radio enable"? Or should KEYCODE be another magic number?

FWIW my wifi hardware button's keycode is 246.

But I would have thought the files to peruse might be:

  $ ls -GlgR /sys/class/rfkill/rfkill0/
  /sys/class/rfkill/rfkill0/:
  total 0
  lrwxrwxrwx 10 Jan 21 16:13 device -> ../../phy0
  -r--r--r-- 1 4096 Jan 21 16:13 hard
  -r--r--r-- 1 4096 Jan 21 16:13 index
  -r--r--r-- 1 4096 Jan 21 16:13 name
  -r--r--r-- 1 4096 Jan 21 16:13 persistent
  drwxr-xr-x 20 Jan 21 16:13 power
  -rw-r--r-- 1 4096 Jan 21 16:13 soft
  -rw-r--r-- 1 4096 Jan 21 16:13 state
  lrwxrwxrwx 10 Jan 21 16:13 subsystem -> ../../../../../../../class/rfkill
  -r--r--r-- 1 4096 Jan 21 16:13 type
  -rw-r--r-- 1 4096 Jan 21 16:13 uevent

  /sys/class/rfkill/rfkill0/power:
  total 0
  -rw-r--r-- 1 4096 Jan 21 16:14 async
  -rw-r--r-- 1 4096 Jan 21 16:14 autosuspend_delay_ms
  -rw-r--r-- 1 4096 Jan 21 16:14 control
  -r--r--r-- 1 4096 Jan 21 16:14 runtime_active_kids
  -r--r--r-- 1 4096 Jan 21 16:14 runtime_active_time
  -r--r--r-- 1 4096 Jan 21 16:14 runtime_enabled
  -r--r--r-- 1 4096 Jan 21 16:14 runtime_status
  -r--r--r-- 1 4096 Jan 21 16:14 runtime_suspended_time
  -r--r--r-- 1 4096 Jan 21 16:14 runtime_usage
  $ 

> What also would be helpfull, is knowning if 
> 
>   echo 4242 > /devics/platform/laptop_chipset/input/input17
> 
> could change brightness (or another visible effect)

Likewise:

  $ ls -GlgR /sys/class/backlight/intel_backlight/
  /sys/class/backlight/intel_backlight/:
  total 0
  -r--r--r-- 1 4096 Jan 21 16:19 actual_brightness
  -rw-r--r-- 1 4096 Jan 21 16:19 bl_power
  -rw-r--r-- 1 4096 Jan 18 21:57 brightness
  lrwxrwxrwx 10 Jan 21 16:19 device -> ../../card1-eDP-1
  -r--r--r-- 1 4096 Jan 18 21:57 max_brightness
  drwxr-xr-x 20 Jan 21 16:19 power
  -r--r--r-- 1 4096 Jan 21 16:19 scale
  lrwxrwxrwx 10 Jan 18 21:57 subsystem -> 
../../../../../../../class/backlight
  -r--r--r-- 1 4096 Jan 18 21:57 type
  -rw-r--r-- 1 4096 Jan 18 21:57 uevent

  /sys/class/backlight/intel_backlight/power:
  total 0
  -rw-r--r-- 1 4096 Jan 21 16:19 async
  -rw-r--r-- 1 4096 Jan 21 16:19 autosuspend_delay_ms
  -rw-r--r-- 1 4096 Jan 21 16:19 control
  -r--r--r-- 1 4096 Jan 21 16:19 runtime_active_kids
  -r--r--r-- 1 4096 Jan 21 16:19 runtime_active_time
  -r--r--r-- 1 4096 Jan 21 16:19 runtime_enabled
  -r--r--r-- 1 4096 Jan 21 16:19 runtime_status
  -r--r--r-- 1 4096 Jan 21 16:19 runtime_suspended_time
  -r--r--r-- 1 4096 Jan 21 16:19 runtime_usage
  $ 

A recent thread on that starts at:

  https://lists.debian.org/debian-user/2023/10/msg00621.html

with a nice algorithm in:

  https://lists.debian.org/debian-user/2023/10/msg00648.html

Cheers,
David.