tiny-pilot / tiny-pilot/tinypilot

Question(/possible Feature?): Sending "Power off" keyboard button signal

Open
#1,863 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
Python
Stars
3.5k
Forks
291
PR merge metrics
No merged PRs in 30d

Description

hi,
i was reading up here: https://github.com/tiny-pilot/tinypilot/wiki/Add-an-RF-controlled-power-socket-to-TinyPilot (😦)
and here: https://forum.tinypilotkvm.com/-29/no-usb-input

... and i was wondering if it would be possible to send the "Power off" keyboard button signal many multimedia keyboards have (not talking about laptops).
I am talking about KBs like these:


So i stumbled upon this: https://wiki.osdev.org/PS/2_Keyboard
and especially this: https://aeb.win.tue.nl/linux/kbd/scancodes-1.html#power

... but not being a linux expert... i just wasted many hours trying to find the right device, how to send codes, how to read(?) available codes, and even just how to print "Hi" as in the example code from the thread above:
echo -ne "\x20\0\xb\0\0\0\0\0" > /dev/hidg0 && \
echo -ne "\0\0\xc\0\0\0\0\0" > /dev/hidg0 && \
echo -ne "\0\0\0\0\0\0\0\0" > /dev/hidg0

This example just prints "H" for me, for some reason.... After many hours i figured out how to print "Hi":

echo -ne "\x20\x00\x0B\x00\x00\x00\x00\x00" "\x8B\x00\x00\x00\x00\x00\x00\x00" > /dev/hidg0 && \
echo -ne "\x00\x00\x0C\x00\x00\x00\x00\x00" "\x8C\x00\x00\x00\x00\x00\x00\x00" > /dev/hidg0

# or simply

echo -ne "\x20\0\x0B\0\0\0\0\0" "\x8B\0\0\0\0\0\0\0" "\0\0\x0C\0\0\0\0\0" "\x8C\0\0\0\0\0\0\0" > /dev/hidg0

is this something that could be done? I think it might even be useful to add it to the "visual" keyboard?

image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how the visual keyboard sends input to /dev/hidg0 and compare that path with the Power-off HID signal described in the issue. Confirm the expected behavior and whether the visual keyboard should expose this key before implementing anything; done means the signal is recognized by a target system and is available from the visual keyboard if that scope is accepted.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux, python, raspberry-pi
Domain
embedded-iot, frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.