Keyboard input remapping for Linux/Wayland 
I have an usb keyboard with missing keys (|,< and >).

For X remapping was done by xmodmap

| is remapped to right AltGr + Y
< is remapped to right AltGr + ;
> is remapped to right AltGr + :

keycode  52 = y Y y Y bar U203A guillemotright
keycode 59 = comma semicolon comma semicolon less multiply periodcentered
keycode 60 = period colon period colon greater division U2026
But under wayland i had to change to evremap (

To automatically activate remapping by a systemd service i did following

discover usb keyboard

#> dmesg
[ 4920.421719] usb 3-4.2: new low-speed USB device number 17 using xhci_hcd
[ 4920.539376] usb 3-4.2: New USB device found, idVendor=0e8f, idProduct=0022, bcdDevice= 2.10
[ 4920.539386] usb 3-4.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 4920.539390] usb 3-4.2: Product: USB KB V11
[ 4920.539392] usb 3-4.2: Manufacturer: GASIA
[ 4920.614311] input: GASIA USB KB V11 as /devices/pci0000:00/0000:00:08.1/0000:03:00.4/usb3/3-4/3-4.2/3-4.2:1.0/0003:0E8F:0022.001A/input/input57
Search for name attribute

#> udevadm info -a -p /devices/pci0000:00/0000:00:08.1/0000:03:00.4/usb3/3-4/3-4.2/3-4.2:1.0/0003:0E8F:0022.001A/input/input57
ATTR{name}=="GASIA USB KB V11"
and build an udev rule for systemd tagging

ACTION!="remove", SUBSYSTEMS=="input", ATTRS{name}=="GASIA USB KB V11", TAG+="systemd"
and reload udev and trigger

#> udevadm control --reload-rules
#> udevadm trigger --attr-match=subsystem=input

and search for a systemd device name with

#> systemctl list-units --type device --no-pager -a | grep V11
  dev-input-by\x2did-usb\x2dGASIA_USB_KB_V11\x2devent\x2dkbd.device                                                                               loaded active plugged USB_KB_V11
dev-input-by\x2dpath-pci\x2d0000:03:00.4\x2dusb\x2d0:4.2:1.0\x2devent\x2dkbd.device loaded active plugged USB_KB_V11
dev-input-event12.device loaded active plugged USB_KB_V11
sys-devices-pci0000:00-0000:00:08.1-0000:03:00.4-usb3-3\x2d4-3\x2d4.2-3\x2d4.2:1.0-0003:0E8F:0022.001A-input-input57-event12.device loaded active plugged USB_KB_V11
sys-devices-pci0000:00-0000:00:08.1-0000:03:00.4-usb3-3\x2d4-3\x2d4.2-3\x2d4.2:1.0-0003:0E8F:0022.001A-input-input57.device loaded active plugged USB_KB_V11
and check for status with

#> systemctl status "dev-input-by\x2did-usb\x2dGASIA_USB_KB_V11\x2devent\x2dkbd.device"
‚óŹ dev-input-by\x2did-usb\x2dGASIA_USB_KB_V11\x2devent\x2dkbd.device - USB_KB_V11
Follows: unit currently follows state of sys-devices-pci0000:00-0000:00:08.1-0000:03:00.4-usb3-3\x2d4-3\x2d4.2-3\x2d4.2:1.0-0003:0E8F:0022.001A-input-input57-event12.device
Loaded: loaded
Active: active (plugged) since Mon 2023-09-25 09:32:57 CEST; 1h 27min ago
Until: Mon 2023-09-25 09:32:57 CEST; 1h 27min ago
Device: /sys/devices/pci0000:00/0000:00:08.1/0000:03:00.4/usb3/3-4/3-4.2/3-4.2:1.0/0003:0E8F:0022.001A/input/input57/event12
and install evremap with correct permission and ownership

#> ls -la /usr/bin/evremap
-rwxr-xr-x 1 root root 15726808 Sep 20 15:37 /usr/bin/evremap
and discover the name with

#> sudo evremap list-devices

and build the remapfile (using evtest to discover keycodes)

device_name = "GASIA USB KB V11"

input = ["KEY_RIGHTALT", "KEY_Z"]
output = ["KEY_RIGHTALT", "KEY_102ND"]

output = ["KEY_102ND"]

input = ["KEY_RIGHTALT", "KEY_DOT"]
output = ["KEY_LEFTSHIFT", "KEY_102ND"]
Description=Keyboard Remap

ExecStart=/usr/bin/evremap remap /etc/evremap.toml -d 0

#> systemd enable evremap

[ view entry ] ( 1093 views )   |  print article
packet capture with ssh and tcpdump on a remote host and display with wireshark 
#> mkfifo /tmp/shark
#> ssh USER@HOST 'sudo -S /usr/sbin/tcpdump -i eth0 -w - -p -n -s 0' > /tmp/shark

In an other session
#> sudo wireshark -k -i /tmp/shark

Then go back to first session and enter the ssh password.

Or in one line
#> ssh USER@HOST 'sudo -S /usr/sbin/tcpdump -i eth0 -w - -p -n -s 0' | wireshark -k -i -

[ view entry ] ( 1407 views )   |  print article
systemd-networkd - Play AP on plugin of your USB WIFI Stick 
check wifi device name
~# ip addr | grep -A 5 wlan
10: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop qlen 1000

IP configuration of your Wifi Stick for systemd-networkd




Autostart of hostapd

Requires=sys-subsystem-net-devices-wlan0.device systemd-networkd.service

~# systemctl enable hostapd
Autostop of hostapd


[ view entry ] ( 9430 views )   |  print article
forward http requests to an other host 
iptables -t nat -A PREROUTING -p tcp -d THISIP --dport 80 -j DNAT --to-destination OTHERIP:80
iptables -t nat -A POSTROUTING -p tcp -d OTHERIP --dport 80 -j MASQUERADE
iptables -I FORWARD -p tcp -d OTHERIP --dport 80 -j ACCEPT

[ view entry ] ( 3186 views )   |  print article
Multiple em28xx USB devices not automatically detected by the module 
I got multiple USB devices working with em28xx module.

Usually a module option gives the em28xx module the order of the devices if not automatically detected
(ex. options em28xx card=80,92,9,9).

But the order at boot is every time different (order for module option not usb detection).

The only working solution for me is to manual loading, scan the order from kernel logs, unload and load with the scanned order:

blacklist em28xx
blacklist em28xx_v4l
blacklist em28xx_dvb
blacklist em28xx_rc

Description=em28xx card sequence detection
Before=motion.service vdr.service




modprobe em28xx
sleep 1
modprobe -r em28xx_rc
modprobe -r em28xx_v4l
modprobe -r em28xx_dvb
modprobe -r em28xx

for line in $(dmesg|grep em28xx|grep 'New device'|tail -4)
[ -z "$cards" ] || cards="${cards},"
case "$line" in
*eb1a:2821*) cards="${cards}9" ;;
*2013:024c*) cards="${cards}80" ;;
*2013:0258*) cards="${cards}92" ;;

modprobe em28xx card=$cards disable_ir=1 disable_usb_speed_check=1

sleep 10

[ view entry ] ( 8111 views )   |  print article

| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | Next> Last>>