GPIO as Keyboard on Linux

The Linux kernel provides the gpio-keys driver (CONFIG_KEYBOARD_GPIO) that can map GPIO pins to keyboard keys and expose them to userspace as input devices. Minimal device tree overlay fragment example: &{/} { gpio_keys { compatible = "gpio-keys"; #address-cells = <1>; #size-cells = <0>; enter_button { label = "enter"; linux,code = <KEY_ENTER>; gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>; }; }; }; Check your board documentation and device tree for GPIO controller names, indexes, and mapping to physical pins. You might also need to adjust pinctrl for multiplexing and pin configuration. ...

July 29, 2025 · 2 min · 248 words · Maxim

Monitor Progress of Data Transfer in Console

Linux provides at least two handy command-line tools to monitor data transfer progress: bar and pv. Both display a one-line progress bar with speed, elapsed or estimated time, and provide customizable formatting. Examples with bar: If data size is unknown: dd if=/dev/zero | bar | dd of=/dev/null 2.3GB at 581.8MB/s elapsed: 0:00:04 If data size is known: dd if=/dev/zero iflag=count_bytes count=10G | bar --size 10G | dd of=/dev/null 1.2GB at 592.8MB/s eta: 0:00:15 11% [===== ] Examples with pv: ...

July 21, 2025 · 1 min · 172 words · Maxim

Interacting with I2C Peripherals from Linux Console

When you need to interact with I2C peripherals from the Linux console, for example during hardware bringup phase, you can use command line utilities available in the i2c-tools package. This is much faster than making changes in Linux kernel drivers, as no recompilation, installation, or reboots are needed. In my case, it was a camera device, and I had to make sure that the camera was available on the I2C bus. ...

July 17, 2025 · 2 min · 355 words · Maxim