forked from mirror/qmk_firmware
Upstream merge up to 02d44beb44
This commit is contained in:
@@ -19,18 +19,19 @@ from __future__ import print_function
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
import argparse
|
||||
import usb
|
||||
|
||||
|
||||
def checkForKeyboardInNormalMode():
|
||||
def check_keyboard_normal_mode(vendor, product):
|
||||
"""Returns a device if a ps2avrGB device in normal made (that is in keyboard mode) or None if it is not found."""
|
||||
return usb.core.find(idVendor=0x20A0, idProduct=0x422D)
|
||||
return usb.core.find(idVendor=vendor, idProduct=product)
|
||||
|
||||
def checkForKeyboardInBootloaderMode():
|
||||
def check_keyboard_bootloader_mode():
|
||||
"""Returns True if a ps2avrGB device in bootloader (flashable) mode is found and False otherwise."""
|
||||
return (usb.core.find(idVendor=0x16c0, idProduct=0x05df) is not None)
|
||||
|
||||
def flashKeyboard(firmware_file):
|
||||
def flash_keyboard(firmware_file):
|
||||
"""Calls bootloadHID to flash the given file to the device."""
|
||||
print('Flashing firmware to device ...')
|
||||
if os.system('bootloadHID -r "%s"' % firmware_file) == 0:
|
||||
@@ -38,7 +39,7 @@ def flashKeyboard(firmware_file):
|
||||
else:
|
||||
print('\nbootloadHID returned an error.')
|
||||
|
||||
def printDeviceInfo(dev):
|
||||
def print_device_info(dev):
|
||||
"""Prints all infos for a given USB device"""
|
||||
print('Device Information:')
|
||||
print(' idVendor: %d (0x%04x)' % (dev.idVendor, dev.idVendor))
|
||||
@@ -47,15 +48,15 @@ def printDeviceInfo(dev):
|
||||
print('Serial: %s' % (dev.iSerialNumber))
|
||||
print('Product: %s' % (dev.iProduct), end='\n\n')
|
||||
|
||||
def sendDeviceToBootloaderMode(dev):
|
||||
def send_device_to_bootloader_mode(dev):
|
||||
"""Tries to send a given ps2avrGB keyboard to bootloader mode to allow flashing."""
|
||||
try:
|
||||
dev.set_configuration()
|
||||
|
||||
request_type = usb.util.build_request_type(
|
||||
usb.util.CTRL_OUT,
|
||||
usb.util.CTRL_TYPE_CLASS,
|
||||
usb.util.CTRL_RECIPIENT_DEVICE)
|
||||
usb.util.CTRL_OUT,
|
||||
usb.util.CTRL_TYPE_CLASS,
|
||||
usb.util.CTRL_RECIPIENT_DEVICE)
|
||||
|
||||
USBRQ_HID_SET_REPORT = 0x09
|
||||
HID_REPORT_OPTION = 0x0301
|
||||
@@ -65,16 +66,21 @@ def sendDeviceToBootloaderMode(dev):
|
||||
# for some reason I keep getting USBError, but it works!
|
||||
pass
|
||||
|
||||
def auto_int(value):
|
||||
"""Helper for argparse to enable auto base detection"""
|
||||
return int(value, 0)
|
||||
|
||||
if len(sys.argv) < 2:
|
||||
print('Usage: %s <firmware.hex>' % sys.argv[0])
|
||||
sys.exit(1)
|
||||
parser = argparse.ArgumentParser(description='Flash bootloadHID device')
|
||||
parser.add_argument('--vendor', type=auto_int, default=0x20A0, help='Non bootloader idVendor to search for (default: 0x%(default)04x)')
|
||||
parser.add_argument('--product', type=auto_int, default=0x422D, help='Non bootloader idProduct to search for (default: 0x%(default)04x)')
|
||||
parser.add_argument('firmware_hex', type=argparse.FileType('r'), help='Firmware hex file to flash')
|
||||
args = parser.parse_args()
|
||||
|
||||
kb = checkForKeyboardInNormalMode()
|
||||
kb = check_keyboard_normal_mode(args.vendor, args.product)
|
||||
|
||||
if kb is not None:
|
||||
print('Found a keyboard in normal mode. Attempting to send it to bootloader mode ...', end='')
|
||||
sendDeviceToBootloaderMode(kb)
|
||||
send_device_to_bootloader_mode(kb)
|
||||
print(' done.')
|
||||
print("Hint: If your keyboard can't be set to bootloader mode automatically, plug it in while pressing the bootloader key to do so manually.")
|
||||
print(" You can find more infos about this here: https://github.com/qmk/qmk_firmware/tree/master/keyboards/ps2avrGB#setting-the-board-to-bootloader-mode")
|
||||
@@ -84,9 +90,9 @@ found = False
|
||||
for attempt in range(1, attempts + 1):
|
||||
print("Searching for keyboard in bootloader mode (%i/%i) ... " % (attempt, attempts), end='')
|
||||
|
||||
if checkForKeyboardInBootloaderMode():
|
||||
if check_keyboard_bootloader_mode():
|
||||
print('Found', end='\n\n')
|
||||
flashKeyboard(sys.argv[1])
|
||||
flash_keyboard(args.firmware_hex.name)
|
||||
found = True
|
||||
break
|
||||
else:
|
||||
@@ -102,4 +108,3 @@ for attempt in range(1, attempts + 1):
|
||||
if not found:
|
||||
print("Couldn't find a flashable keyboard. Aborting.")
|
||||
sys.exit(2)
|
||||
|
||||
|
||||
154
util/bootloader_atmega32a_1_0_0.hex
Normal file
154
util/bootloader_atmega32a_1_0_0.hex
Normal file
@@ -0,0 +1,154 @@
|
||||
:107000000C9468380C94A0380C9485380C9485380E
|
||||
:107010000C9485380C9485380C9485380C948538FC
|
||||
:107020000C9485380C9485380C9485380C948538EC
|
||||
:107030000C9485380C9485380C9485380C948538DC
|
||||
:107040000C9485380C9485380C9485380C948538CC
|
||||
:107050000C9485380403090412036F006200640075
|
||||
:10706000650076002E00610074001003480049009E
|
||||
:10707000440042006F006F00740012011001000014
|
||||
:107080000008C016DF05000101020001090222000C
|
||||
:107090000101008032090400000103000000092101
|
||||
:1070A00001010001222100070581030800C8060034
|
||||
:1070B000FF0901A101150026FF007508850195064D
|
||||
:1070C0000900B20201850295830900B20201C000E5
|
||||
:1070D00011241FBECFE5D8E0DEBFCDBF10E0A0E693
|
||||
:1070E000B0E0ECE6F9E702C005900D92AA36B107D0
|
||||
:1070F000D9F710E0AAE6B0E001C01D92A43AB107AA
|
||||
:10710000E1F70E94173C0C94B43C0C940038A82F73
|
||||
:10711000B92F80E090E041E050EA609530E009C08E
|
||||
:107120002D9182279795879510F084279527305EBB
|
||||
:10713000C8F36F5FA8F30895EADF8D939D930895D8
|
||||
:10714000CF93CFB7CF93C395839BE9F7839B09C0B8
|
||||
:10715000839B07C0839B05C0839B03C0839B01C0A7
|
||||
:10716000A3C0DF93C0918700DD27C257DF4F839B09
|
||||
:1071700002C0DF91EBCF2F930F931F9300B32FEF3C
|
||||
:1071800003FB20F94F933F9310B34FEF012703FB0D
|
||||
:1071900021F93BE031C04E7F012F10B3216028C0A0
|
||||
:1071A000102F4D7F2260000000B329C04B7F246068
|
||||
:1071B000012F000010B32BC010B3477F28602AC0F6
|
||||
:1071C0004F7E00B320612CC04F7D10B320622FC0D2
|
||||
:1071D0004F7B00B3206432C0422700B349934FEF86
|
||||
:1071E0000000102713FB20F910B31C70C9F1297F90
|
||||
:1071F00091F2012703FB21F900B3237F89F231507B
|
||||
:1072000058F1102713FB22F910B3277E79F20127DA
|
||||
:1072100003FB23F92F7C81F200B3102713FB24F921
|
||||
:107220002F7971F200C010B3012703FB25F92F73EA
|
||||
:1072300059F200C000B3102713FB26F9223040F2A8
|
||||
:1072400000C010B3012703FB27F9243028F64F773D
|
||||
:10725000206810B30000F9CF10E41ABF002719C04E
|
||||
:107260003B503195C31BD04010E41ABF0881033C4A
|
||||
:10727000F9F00B34E9F0209185001981110F1213F8
|
||||
:10728000EDCF4A81441F093641F10D3211F0013E24
|
||||
:1072900029F700938C003F914F911F910F912F91EF
|
||||
:1072A000DF91CAB7C6FD4FCFCF91CFBFCF91189511
|
||||
:1072B00020918C00222379F310918A00112321F56B
|
||||
:1072C000343022F130938A00209386001091870099
|
||||
:1072D0003BE0311B3093870019C000918A000130D8
|
||||
:1072E0009CF40AE54F7081F43091600034FD10C0C9
|
||||
:1072F00000936000C9E7D0E00FC02795A8F4515073
|
||||
:10730000A9F4220F0000F9CF4AE503C042ED01C005
|
||||
:10731000432FC4E1D0E032E011B31C60939A11BB5B
|
||||
:1073200002B320E41CE05F93012756E002BB2795DF
|
||||
:1073300020F4515021F4220FF9CF012756E000002C
|
||||
:107340003B5A02BBD0F2279528F4515029F4220F62
|
||||
:107350000000F9CF012756E0279502BB20F45150D9
|
||||
:1073600021F4220FF9CF012756E02991332302BBE4
|
||||
:1073700021F6037F10918B00110FC651D04002BB44
|
||||
:1073800011F01093850010E41ABF086011B3137F49
|
||||
:10739000402F437F5F9100C000C002BB11BB42BBC6
|
||||
:1073A0007ACF80916D00882309F445C088EB9BE07B
|
||||
:1073B0000197F1F780916A008F5F80936A00909146
|
||||
:1073C00061008917B1F510926A0080916B008230DC
|
||||
:1073D000C1F0833028F4882341F0813041F50CC09E
|
||||
:1073E0008330B9F0843019F519C082B38C7A82BB2E
|
||||
:1073F00081E080936B0017C082B3836582BB82E01B
|
||||
:1074000004C082B38C7A82BB83E080936B008FE7E9
|
||||
:107410000BC082B3836582BB84E0F7CF82B38C7AE2
|
||||
:1074200082BB10926B008FEF8093610002C01092BC
|
||||
:107430006B0081E0089529B3237040916E000DC068
|
||||
:1074400089B330E090E0837090702817390711F00D
|
||||
:1074500040E001C04F5F29B32370463088F320938A
|
||||
:10746000720040936E00233018F481E080936D0029
|
||||
:1074700080916D00089585B7826085BF8BB7806469
|
||||
:107480008BBF0895F89481E180935700E8951BBE67
|
||||
:1074900015BE81E08BBF1BBE8B9AE0917700F09107
|
||||
:1074A0007800099521E020936C00FC0181818930EE
|
||||
:1074B00069F48281823029F420937500209384003E
|
||||
:1074C00003C082E0809384008FEF0895813011F033
|
||||
:1074D00080E0089582E690E0909389008093880090
|
||||
:1074E00087E00895CF93DF93DC01C0917000D091C5
|
||||
:1074F0007100413051F410926F001196CC911197A8
|
||||
:107500001296DC9112971496645030916F00360FEA
|
||||
:1075100030936F00AE014F7751F4F89483E0FE0191
|
||||
:1075200080935700E895789407B600FCFDCFF89457
|
||||
:10753000AE018D919C91119721E0FE010C012093E9
|
||||
:107540005700E895112478942296FE01EF7751F4C4
|
||||
:10755000F89485E0FA0180935700E895789407B68F
|
||||
:1075600000FCFDCF625011F01296D4CFD093710081
|
||||
:10757000C0937000832F8078DF91CF910895CF93CF
|
||||
:10758000DF93FC0180918400813071F4809175005B
|
||||
:10759000813029F410927500CF0141E002C0CF0183
|
||||
:1075A00040E00E94723A2FC0823061F581818130C3
|
||||
:1075B00011F40E94423A8F3F21F484E090E06FEF93
|
||||
:1075C00019C08E3F91F482B3836582BBC0E0D0E0E6
|
||||
:1075D000CE016FEF0E94A73C219684E0C030D8070F
|
||||
:1075E000B9F782B38C7A82BB0BC08D3F31F48281B4
|
||||
:1075F000938164810E94A73C03C081E08093760060
|
||||
:107600001092840081E0DF91CF9108951F93CF9372
|
||||
:10761000DF9360918A00635067FDBAC08091870054
|
||||
:10762000CCE0D0E0C81BD109C257DF4F8091860063
|
||||
:107630008D3209F09AC0683009F0A8C083EC8093BD
|
||||
:1076400079008AE5809360001092740088818076CA
|
||||
:1076500041F0CE010E94523A282F8F3F09F474C0A6
|
||||
:107660007AC09A81109282008981882321F4109235
|
||||
:10767000830022E062C0853019F490938B005CC0D7
|
||||
:10768000863009F04AC08B81813019F48AE790E78F
|
||||
:107690001BC0823041F48CE890E79093890080937E
|
||||
:1076A000880022E236C08330F9F48A81882341F4CD
|
||||
:1076B00084E590E7909389008093880024E029C0B6
|
||||
:1076C000813041F488E590E79093890080938800A9
|
||||
:1076D00022E11FC08230E1F48AE690E790938900AE
|
||||
:1076E0008093880020E115C0813241F48EE990E753
|
||||
:1076F000909389008093880029E00BC0823241F486
|
||||
:107700008EEA90E7909389008093880021E201C07F
|
||||
:1077100020E080E4809374001EC0883021F421E0D2
|
||||
:107720008DE890E00CC0893019F490938D0004C06E
|
||||
:107730008A3011F421E001C020E082E890E09093CB
|
||||
:1077400089008093880007C0888187FD2E8180E8AA
|
||||
:107750008093740006C08F81882319F48E8182176C
|
||||
:1077600008F0822F8093690011C08091740087FF18
|
||||
:107770000DC0CE010E94BF3A8F3F21F48EE180936D
|
||||
:10778000600004C0882311F01092690010928A00F2
|
||||
:107790008091600084FF3DC0809169008F3FC9F1F6
|
||||
:1077A000182F893008F018E0811B809369008091C0
|
||||
:1077B000790098E88927809379001123E1F0E0911E
|
||||
:1077C0008800F09189008091740086FF09C0912F94
|
||||
:1077D000AAE7B0E084918D9331969150D9F707C014
|
||||
:1077E000912FAAE7B0E081918D939150E1F7F0934A
|
||||
:1077F0008900E09388008AE790E0612F0E949C381E
|
||||
:10780000612F6C5F6C3019F08FEF8093690060938B
|
||||
:10781000600094E180B38C7031F49150D9F71092EC
|
||||
:107820008B0010928500DF91CF911F91089581B355
|
||||
:10783000836581BB82B38C7A82BB8D98959A8AB31B
|
||||
:107840008C7F8ABB8BB383608BBBB89AC09881E076
|
||||
:1078500090E00E948E3C80937300882349F481E07D
|
||||
:1078600080936D0081E090E06FEF0E94A73C08C01C
|
||||
:10787000E0E0F0E0E491EF3F19F481E080936D00E7
|
||||
:107880000E94D139882309F447C081E08BBF82E090
|
||||
:107890008BBF0E943B3A88E991E00E948E3C88238E
|
||||
:1078A00049F48B9A20E0A89588EB9BE00197F1F7CB
|
||||
:1078B0002150C9F78B9878940FEF10E0C0E0D0E02A
|
||||
:1078C00080916C008823B9F483E0C93ED80714F492
|
||||
:1078D000219611C0F89481E090E060E00E94963C0F
|
||||
:1078E0008B9A28E088E190E00FB6F894A89581BDC6
|
||||
:1078F0000FBE21BDFFCFA8950E94063B8091760068
|
||||
:10790000882331F0002319F4115011F405C00150FF
|
||||
:107910000E94D1398823A1F60E94423AE199FECF14
|
||||
:107920009FBB8EBBE09A99278DB30895262FE199CE
|
||||
:10793000FECF9FBB8EBBE09A01970DB2021631F0CD
|
||||
:107940002DBB0FB6F894E29AE19A0FBE0895262F48
|
||||
:10795000E199FECF9FBB8EBB2DBB0FB6F894E29A88
|
||||
:0C796000E19A0FBE01960895F894FFCF45
|
||||
:0A796C005A7F01800000800000FF38
|
||||
:040000030000700089
|
||||
:00000001FF
|
||||
50
util/docker_build.sh
Executable file
50
util/docker_build.sh
Executable file
@@ -0,0 +1,50 @@
|
||||
#!/bin/sh
|
||||
# NOTE: This script uses tabs for indentation
|
||||
|
||||
USAGE="Usage: $0 [keyboard[:keymap[:target]]]"
|
||||
|
||||
# Check preconditions
|
||||
for arg; do
|
||||
if [ "$arg" = "--help" ]; then
|
||||
echo "$USAGE"
|
||||
exit 0
|
||||
fi
|
||||
done
|
||||
if [ $# -gt 1 ]; then
|
||||
echo "$USAGE" >&2
|
||||
exit 1
|
||||
elif ! command -v docker >/dev/null 2>&1; then
|
||||
echo "Error: docker not found" >&2
|
||||
echo "See https://docs.docker.com/install/#supported-platforms for installation instructions" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
# Determine arguments
|
||||
if [ $# -eq 0 ]; then
|
||||
printf "keyboard=" && read -r keyboard
|
||||
[ -n "$keyboard" ] && printf "keymap=" && read -r keymap
|
||||
[ -n "$keymap" ] && printf "target=" && read -r target
|
||||
else
|
||||
IFS=':' read -r keyboard keymap target x <<-EOF
|
||||
$1
|
||||
EOF
|
||||
if [ -n "$x" ]; then
|
||||
echo "$USAGE" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
if [ -n "$target" ]; then
|
||||
if [ "$(uname)" = "Linux" ] || docker-machine active >/dev/null 2>&1; then
|
||||
usb_args="--privileged -v /dev/bus/usb:/dev/bus/usb"
|
||||
else
|
||||
echo "Error: target requires docker-machine to work on your platform" >&2
|
||||
echo "See http://gw.tnode.com/docker/docker-machine-with-usb-support-on-windows-macos" >&2
|
||||
echo "Consider flashing with QMK Toolbox (https://github.com/qmk/qmk_toolbox) instead" >&2
|
||||
exit 3
|
||||
fi
|
||||
fi
|
||||
dir=$(pwd -W 2>/dev/null) || dir=$PWD # Use Windows path if on Windows
|
||||
|
||||
# Run container and build firmware
|
||||
docker run --rm -it $usb_args -v "$dir":/qmk_firmware qmkfm/qmk_firmware \
|
||||
make "$keyboard${keymap:+:$keymap}${target:+:$target}"
|
||||
@@ -32,7 +32,7 @@ if grep ID /etc/os-release | grep -qE "fedora"; then
|
||||
elif grep ID /etc/os-release | grep -qE 'debian|ubuntu'; then
|
||||
DEBIAN_FRONTEND=noninteractive
|
||||
DEBCONF_NONINTERACTIVE_SEEN=true
|
||||
export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN
|
||||
export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN
|
||||
sudo apt-get update
|
||||
sudo apt-get install \
|
||||
build-essential \
|
||||
@@ -70,20 +70,18 @@ elif grep ID /etc/os-release | grep -q 'arch\|manjaro'; then
|
||||
wget \
|
||||
zip
|
||||
git clone https://aur.archlinux.org/dfu-programmer.git /tmp/dfu-programmer
|
||||
cd /tmp/dfu-programmer
|
||||
cd /tmp/dfu-programmer || exit 1
|
||||
makepkg -sic
|
||||
rm -rf /tmp/dfu-programmer/
|
||||
|
||||
elif grep ID /etc/os-release | grep -q gentoo; then
|
||||
echo GENTOO_WARNING | fmt
|
||||
echo -n "Proceed (y/N)? "
|
||||
old_stty_cfg=$(stty -g)
|
||||
stty raw -echo
|
||||
answer=$( while ! head -c 1 | grep -i '[ny]' ;do true ;done )
|
||||
stty $old_stty_cfg
|
||||
if echo "$answer" | grep -iq "^y" ;then
|
||||
echo "$GENTOO_WARNING" | fmt
|
||||
printf "\nProceed (y/N)? "
|
||||
read -r answer
|
||||
if echo "$answer" | grep -iq "^y"; then
|
||||
sudo touch /etc/portage/package.use/qmkfirmware
|
||||
echo "sys-devel/gcc multilib" | sudo tee --append /etc/portage/package.use/qmkfirmware > /dev/null
|
||||
# tee is used here since sudo doesn't apply to >>
|
||||
echo "sys-devel/gcc multilib" | sudo tee --append /etc/portage/package.use/qmkfirmware >/dev/null
|
||||
sudo emerge -auN \
|
||||
app-arch/unzip \
|
||||
app-arch/zip \
|
||||
|
||||
@@ -14,8 +14,9 @@ source "$dir/win_shared_install.sh"
|
||||
function install_avr {
|
||||
rm -f -r "$avrtools"
|
||||
wget "http://ww1.microchip.com/downloads/en/DeviceDoc/avr8-gnu-toolchain-3.6.1.1752-win32.any.x86.zip"
|
||||
7z x avr8-gnu-toolchain-3.6.1.1752-win32.any.x86.zip
|
||||
mv avr8-gnu-toolchain-win32_x86/ avr8-gnu-toolchain
|
||||
echo "Extracting AVR toolchain..."
|
||||
unzip -q avr8-gnu-toolchain-3.6.1.1752-win32.any.x86.zip
|
||||
mv avr8-gnu-toolchain-win32_x86/ avr8-gnu-toolchain
|
||||
rm __MACOSX -R
|
||||
rm avr8-gnu-toolchain-3.6.1.1752-win32.any.x86.zip
|
||||
pacman --needed -S mingw-w64-x86_64-avrdude
|
||||
|
||||
@@ -43,7 +43,11 @@ GIT=$(whereis git)
|
||||
if [ "$GIT" != "" ]; then
|
||||
IS_GIT_REPO=$($GIT log >>/dev/null 2>&1; echo $?)
|
||||
if [ "$IS_GIT_REPO" -eq 0 ]; then
|
||||
ID="'$($GIT config --get user.name)'"
|
||||
ID="$($GIT config --get user.name)"
|
||||
read -rp "What is your name? [$ID] " YOUR_NAME
|
||||
if [ -n "$YOUR_NAME" ]; then
|
||||
ID=$YOUR_NAME
|
||||
fi
|
||||
echo "Using $ID as user name"
|
||||
|
||||
for i in "$NEW_KBD/config.h" \
|
||||
@@ -52,7 +56,7 @@ if [ "$GIT" != "" ]; then
|
||||
"$NEW_KBD/keymaps/default/config.h" \
|
||||
"$NEW_KBD/keymaps/default/keymap.c"
|
||||
do
|
||||
awk -v id="$ID" '{sub(/REPLACE_WITH_YOUR_NAME/,id); print}' < "$i" > "$i.$$"
|
||||
awk -v id="$ID" '{sub(/%YOUR_NAME%/,id); print}' < "$i" > "$i.$$"
|
||||
mv "$i.$$" "$i"
|
||||
done
|
||||
fi
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
|
||||
TRAVIS_COMMIT_MESSAGE="${TRAVIS_COMMIT_MESSAGE:-none}"
|
||||
TRAVIS_COMMIT_RANGE="${TRAVIS_COMMIT_RANGE:-HEAD~1..HEAD}"
|
||||
MAKE_ALL="make all:default AUTOGEN=\"true\""
|
||||
MAKE_ALL="make all:default"
|
||||
|
||||
if [[ "$TRAVIS_COMMIT_MESSAGE" != *"[skip build]"* ]] ; then
|
||||
if [[ "$TRAVIS_COMMIT_MESSAGE" != *"[skip build]"* ]] ; then
|
||||
exit_code=0
|
||||
git diff --name-only -n 1 ${TRAVIS_COMMIT_RANGE}
|
||||
if [ $? -eq 128 ]; then
|
||||
@@ -17,28 +17,30 @@ if [[ "$TRAVIS_COMMIT_MESSAGE" != *"[skip build]"* ]] ; then
|
||||
else
|
||||
NEFM=$(git diff --name-only -n 1 ${TRAVIS_COMMIT_RANGE} | grep -Ev '^(keyboards/)' | grep -Ev '^(docs/)' | wc -l)
|
||||
BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
||||
# is this branch master or a "non docs, non keyboards" change
|
||||
if [ $NEFM -gt 0 -o "$BRANCH" = "master" ]; then
|
||||
echo "Making default keymaps for all keyboards"
|
||||
eval $MAKE_ALL
|
||||
: $((exit_code = $exit_code + $?))
|
||||
else
|
||||
MKB=$(git diff --name-only -n 1 ${TRAVIS_COMMIT_RANGE} | grep -oP '(?<=keyboards\/)([a-zA-Z0-9_\/]+)(?=\/)' | sort -u)
|
||||
# keyboards project format
|
||||
# /keyboards/board1/rev/keymaps/
|
||||
# /keyboards/board2/keymaps/
|
||||
# ensure we strip everything off after and including the keymaps folder to get board and/or revision
|
||||
MKB=$(git diff --name-only -n 1 ${TRAVIS_COMMIT_RANGE} | grep -oP '(?<=keyboards\/)([a-zA-Z0-9_\/]+)(?=\/)' | sed 's^/keymaps/.*^^' | sort -u)
|
||||
for KB in $MKB ; do
|
||||
if [[ $KB == *keymaps* ]]; then
|
||||
continue
|
||||
fi
|
||||
KEYMAP_ONLY=$(git diff --name-only -n 1 ${TRAVIS_COMMIT_RANGE} | grep -Ev '^(keyboards/'${KB}'/keymaps/)' | wc -l)
|
||||
if [[ $KEYMAP_ONLY -gt 0 ]]; then
|
||||
echo "Making all keymaps for $KB"
|
||||
make ${KB}:all AUTOGEN=true
|
||||
make ${KB}:all
|
||||
: $((exit_code = $exit_code + $?))
|
||||
else
|
||||
MKM=$(git diff --name-only -n 1 ${TRAVIS_COMMIT_RANGE} | grep -oP '(?<=keyboards/'${KB}'/keymaps/)([a-zA-Z0-9_]+)(?=\/)' | sort -u)
|
||||
for KM in $MKM ; do
|
||||
echo "Making $KM for $KB"
|
||||
make ${KB}:${KM} AUTOGEN=true
|
||||
echo "Making $KM for $KB"
|
||||
make ${KB}:${KM}
|
||||
: $((exit_code = $exit_code + $?))
|
||||
done
|
||||
done
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
@@ -1,27 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
TRAVIS_BRANCH="${TRAVIS_BRANCH:master}"
|
||||
TRAVIS_PULL_REQUEST="${TRAVIS_PULL_REQUEST:false}"
|
||||
TRAVIS_COMMIT_MESSAGE="${TRAVIS_COMMIT_MESSAGE:-none}"
|
||||
TRAVIS_COMMIT_RANGE="${TRAVIS_COMMIT_RANGE:-HEAD~1..HEAD}"
|
||||
source util/travis_push.sh
|
||||
|
||||
set -o errexit -o nounset
|
||||
|
||||
rev=$(git rev-parse --short HEAD)
|
||||
echo "Using git hash ${rev}"
|
||||
|
||||
if [[ "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" == "false" ]] ; then
|
||||
|
||||
git config --global user.name "QMK Bot"
|
||||
git config --global user.email "hello@qmk.fm"
|
||||
|
||||
openssl aes-256-cbc -K $encrypted_b0ee987fd0fc_key -iv $encrypted_b0ee987fd0fc_iv -in secrets.tar.enc -out secrets.tar -d
|
||||
tar xvf secrets.tar
|
||||
|
||||
chmod 600 id_rsa_qmk_firmware
|
||||
chmod 600 id_rsa_qmk.fm
|
||||
eval `ssh-agent -s`
|
||||
ssh-add id_rsa_qmk_firmware
|
||||
|
||||
# convert to unix line-endings
|
||||
git checkout master
|
||||
git diff --diff-filter=M --name-only -n 1 -z ${TRAVIS_COMMIT_RANGE} | xargs -0 dos2unix
|
||||
@@ -34,7 +21,7 @@ increment_version ()
|
||||
part[2]=$((part[2] + 1))
|
||||
new="${part[*]}"
|
||||
echo -e "${new// /.}"
|
||||
}
|
||||
}
|
||||
|
||||
git diff --name-only -n 1 ${TRAVIS_COMMIT_RANGE}
|
||||
|
||||
@@ -63,18 +50,17 @@ if [[ "$TRAVIS_COMMIT_MESSAGE" != *"[skip build]"* ]] ; then
|
||||
ssh-add -D
|
||||
eval `ssh-agent -s`
|
||||
ssh-add id_rsa_qmk.fm
|
||||
|
||||
|
||||
# don't delete files in case not all keyboards are built
|
||||
# rm -f compiled/*.hex
|
||||
|
||||
# ignore errors here
|
||||
for file in ../qmk_firmware/keyboards/*/keymaps/*/*_default.hex; do mv -v "$file" "compiled/${file##*/}" || true; done
|
||||
for file in ../qmk_firmware/keyboards/*/*/keymaps/*/*_default.hex; do mv -v "$file" "compiled/${file##*/}" || true; done
|
||||
for file in ../qmk_firmware/keyboards/*/*/*/keymaps/*/*_default.hex; do mv -v "$file" "compiled/${file##*/}" || true; done
|
||||
for file in ../qmk_firmware/keyboards/*/*/*/*/keymaps/*/*_default.hex; do mv -v "$file" "compiled/${file##*/}" || true; done
|
||||
# In theory, this is more flexible, and will allow for additional expansion of additional types of files and other names
|
||||
mv ../qmk_firmware/*_default.*[hb][ei][xn] ./compiled/ || true
|
||||
|
||||
bash _util/generate_keyboard_page.sh
|
||||
git add -A
|
||||
git commit -m "generated from qmk/qmk_firmware@${rev}"
|
||||
git commit -m "generated from qmk/qmk_firmware@${rev}"
|
||||
git push git@github.com:qmk/qmk.fm.git
|
||||
|
||||
fi
|
||||
|
||||
@@ -5,13 +5,15 @@ TRAVIS_PULL_REQUEST="${TRAVIS_PULL_REQUEST:false}"
|
||||
TRAVIS_COMMIT_MESSAGE="${TRAVIS_COMMIT_MESSAGE:-none}"
|
||||
TRAVIS_COMMIT_RANGE="${TRAVIS_COMMIT_RANGE:-HEAD~1..HEAD}"
|
||||
|
||||
git config --global user.name "QMK Bot"
|
||||
git config --global user.email "hello@qmk.fm"
|
||||
if [[ "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" == "false" ]] ; then
|
||||
git config --global user.name "QMK Bot"
|
||||
git config --global user.email "hello@qmk.fm"
|
||||
|
||||
openssl aes-256-cbc -K $encrypted_b0ee987fd0fc_key -iv $encrypted_b0ee987fd0fc_iv -in secrets.tar.enc -out secrets.tar -d
|
||||
tar xvf secrets.tar
|
||||
openssl aes-256-cbc -K $encrypted_b0ee987fd0fc_key -iv $encrypted_b0ee987fd0fc_iv -in secrets.tar.enc -out secrets.tar -d
|
||||
tar xvf secrets.tar
|
||||
|
||||
chmod 600 id_rsa_qmk_firmware
|
||||
chmod 600 id_rsa_qmk.fm
|
||||
eval `ssh-agent -s`
|
||||
ssh-add id_rsa_qmk_firmware
|
||||
chmod 600 id_rsa_qmk_firmware
|
||||
chmod 600 id_rsa_qmk.fm
|
||||
eval `ssh-agent -s`
|
||||
ssh-add id_rsa_qmk_firmware
|
||||
fi
|
||||
|
||||
18
util/usb_detach/Makefile
Normal file
18
util/usb_detach/Makefile
Normal file
@@ -0,0 +1,18 @@
|
||||
# the compiler: gcc for C program, define as g++ for C++
|
||||
CC = gcc
|
||||
|
||||
# compiler flags:
|
||||
# -g adds debugging information to the executable file
|
||||
# -Wall turns on most, but not all, compiler warnings
|
||||
CFLAGS = -g -Wall
|
||||
|
||||
# the build target executable:
|
||||
TARGET = usb_detach
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
$(TARGET): $(TARGET).c
|
||||
$(CC) $(CFLAGS) -o $(TARGET) $(TARGET).c
|
||||
|
||||
clean:
|
||||
$(RM) $(TARGET)
|
||||
14
util/usb_detach/readme.md
Normal file
14
util/usb_detach/readme.md
Normal file
@@ -0,0 +1,14 @@
|
||||
# usb_detach
|
||||
|
||||
When trying to flash on Linux, you may encounter a "Resource Unavailable" error. This means that Linux's HID driver has taken exclusive control of the keyboard, and the program script can't flash it.
|
||||
This program can force Linux to give up a device, so that the programming script can reset it.
|
||||
|
||||
## To compile:
|
||||
```bash
|
||||
make clean && make
|
||||
```
|
||||
|
||||
## To run:
|
||||
1. Use `lsusb` to discover the Bus and Device numbers for your keyboard.
|
||||
2. Run the program: `sudo ./usb_detach /dev/bus/usb/<BUS>/<DEVICE>`.
|
||||
3. Build and program the firmware as normal.
|
||||
34
util/usb_detach/usb_detach.c
Normal file
34
util/usb_detach/usb_detach.c
Normal file
@@ -0,0 +1,34 @@
|
||||
/* Found at https://www.linuxquestions.org/questions/linux-hardware-18/how-to-unclaim-usb-device-558138/#post3406986 */
|
||||
#include <stdio.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <linux/ioctl.h>
|
||||
#include <linux/usbdevice_fs.h>
|
||||
|
||||
int main(int argc, char**argv)
|
||||
{
|
||||
struct usbdevfs_ioctl command;
|
||||
int ret;
|
||||
int fd;
|
||||
int i;
|
||||
if (argc>1) {
|
||||
fd = open(argv[1],O_RDWR);
|
||||
if (fd<1){
|
||||
perror("unable to open file");
|
||||
return 1;
|
||||
}
|
||||
for (i=0;i<255;i++){ // hack: should fetch how many interface there is.
|
||||
command.ifno = i;
|
||||
command.ioctl_code = USBDEVFS_DISCONNECT;
|
||||
command.data = NULL;
|
||||
ret = ioctl(fd, USBDEVFS_IOCTL, &command);
|
||||
if(ret!=-1)
|
||||
printf("un claimed interface %d %d\n",i,ret);
|
||||
}
|
||||
} else {
|
||||
printf ("usage: %s /dev/bus/usb/BUS/DEVICE\n",argv[0]);
|
||||
printf("Release all interfaces of this usb device for usage in virtualisation\n");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user