- Added keyboard detection, finds id for internal and usb keyboards. Added local symbols file for chromebooks running Gallium or normal linux install.

This commit is contained in:
Ryan Reaves
2019-07-27 03:05:49 -05:00
parent f1731134a3
commit e4f96f475b
4 changed files with 66 additions and 12 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
.env/

5
.xkb/symbols/myswap Normal file
View File

@@ -0,0 +1,5 @@
partial modifier_keys
xkb_symbols "swap_lalt_lctrl" {
replace key <LALT> { [ Control_L, Control_L ] };
replace key <LCTL> { [ Alt_L, Meta_L ] };
};

View File

@@ -9,13 +9,19 @@ No more spiderhands for programmers and developers. This project is only about o
1. clone this repo
```
```
2. Install via shell file
git clone https://github.com/rbreaves/kinto.git
```
2. Install python3 (If needed, most current distros have it already)
Debian or Ubuntu 16.04
```
sudo apt update
sudo apt install python3.6
```
3. Follow the prompts and the script will guide you through the rest of the setup.
```
./install.py
```
## Troubleshooting
If your keyboard is not being autodetected and configured then please run `xinput list`, if you are on linux, and copy the output into a ticket under issues.

View File

@@ -1,21 +1,63 @@
import os, platform, sysconfig, sys
#!/usr/bin/env python3
import os, platform, sysconfig, sys, subprocess
yellow = "\033[1;33m"
green = "\033[0;32m"
red = "\033[1;31m"
italic = "\033[3m"
reset = "\033[0;0m"
platform_name = platform.system()
# print sysconfig.get_platform()
sys.stdout.write(yellow)
cloud = '\u2601'.decode('unicode-escape')
circle = '\u25CE'.decode('unicode-escape')
heart = '\u2765'.decode('unicode-escape')
cloud = '\u2601'
circleo = '\u25CE'
clocko = '\u2B6E'
syme = '\u0250'
syma = '\u0251'
# bang = '\u1F589'.decode('unicode-escape')
print " K!nt" + circle
sys.stdout.write(reset)
print " - F!x the damn keyb" + circle + "ard. - "
print
print " You are using: " + platform_name
def hwinfo():
print("Requires user password to display hardware information...")
result = subprocess.check_output('sudo dmidecode | grep -A 9 "System Information" | grep -v "UUID\|Serial\|SKU\|Wake"', shell=True).decode('ascii')
print(result)
def kblist():
result = subprocess.check_output('xinput list', shell=True).decode('ascii')
print(result)
print()
print()
print(" K!nt" + circleo)
sys.stdout.write(reset)
print(italic + " - F!x the d" + syma + "mn k" + syme + "yb" + circleo + syma + "rd. - ")
sys.stdout.write(reset)
print()
input("Press Enter to begin...")
print()
print("Checking for OS and system information...")
print()
print("OS Type")
# print(" Platform: " + platform_name)
if platform_name == 'Linux':
result = subprocess.check_output("lsb_release -a | grep -v LSB ", shell=True).decode('ascii')
print(result)
print()
print("Looking for keyboards...")
print()
result = subprocess.check_output('xinput list | grep -iv "Virtual\|USB" | grep -i "keyboard.*keyboard";exit 0', shell=True).decode('utf-8')
if result != "":
print("Built in keyboard")
print(result)
result = subprocess.check_output('udevadm info -e | grep -o -P "(?<=by-id/usb-).*(?=-event-kbd)" | head -1;exit 0', shell=True).decode('utf-8')
if result != "":
print("USB keyboard")
print(result)
internalid = subprocess.check_output('xinput list | grep -iv "Virtual\|USB" | grep -i "keyboard.*keyboard" | cut -d "=" -f 2- | awk \'{print $1}\';exit 0', shell=True).decode('utf-8')
usbid = subprocess.check_output('udevadm info -e | stdbuf -oL grep -o -P "(?<=event-kbd /dev/input/by-path/pci-0000:00:).*(?=.0-usb)";exit 0', shell=True).decode('utf-8')
print("Internal Keyboard ID: " + internalid + "USB Keyboard ID: " + usbid)