- 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

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)