Mercurial > louis > kiibohd-controller
comparison LoadFile/load.dfu @ 449:45feb80a2ad1
Major USB update, fixes most (if not all) known issues
USB - General
- Refactored descriptors
- Enabled/Disable USB endpoints
- Added debug flags for special features
- Code cleanup
- Interface count calculation based off of enabled endpoints
- Delayed wTotalLength calculation to simplify descriptor offsets
- Re-ordered endpoints and interfaces
- Added more debug output
- Added usbInitTime to show how long keyboard initialization took
(Useful when debugging bad init sequences)
- Added function for usb_resume() which takes care of the resume sequence
* Resume is now only called if packets are starting to timeout
USB - Special Options
- Added enableDeviceRestartOnUSBTimeout
* A last resort hammer for bad USB Chipsets/OSs, don't use if you can help it
* Disabled
- Added enableUSBResume
* Enables host resume wake-up signalling, required to wake a computer from sleep
* Enabled
- Added enableUSBLowPowerNegotiation
* Enables power negotiation hack
* Required to use firmware with an IPad and other hard-limit low-power USB hosts
* Hasn't been tested with the recent changes
* Disabled
- Added enableUSBSuspend
* Enables power down events on host USB bus suspend
* Enabled
USB - Keyboard
- Attempted to cleanup HID SET_REPORT
* Works much better
* Still has an issue under Linux which generates *a lot* of NAKs (initializes quickly regardless)
+ Not present on other keyboards
+ SETUP -> OUT -> IN : This sequence is the problem
+ Specifically during the OUT phase
- Enabled
USB - CDC Virtual Serial Port
- Code cleanup
- Added convenience struct USBCDCLineCoding for easier debugging
- Attempted to cleanup CDC_SET_LING_CODING
* Works much better
* Still has an issue under Linux which generates *a lot* of NAKs (initializes quickly regardless)
+ SETUP -> OUT -> IN : This sequence is the problem
+ Specifically during the OUT phase
+ Likely the same issues as HID SET_REPORT
- Enabled
USB - Mouse
- Enabled
USB - Joystick
- Disabled
USB - RawIO
- Initial code, API not used yet
- Disabled
DFU
- Updated load script, now faster
author | Jacob Alexander <haata@kiibohd.com> |
---|---|
date | Tue, 31 May 2016 00:19:45 -0700 |
parents | 99f93dec8fea |
children |
comparison
equal
deleted
inserted
replaced
448:077a1dfd8529 | 449:45feb80a2ad1 |
---|---|
1 #!/usr/bin/env bash | 1 #!/usr/bin/env bash |
2 # Convenience script for loading firmware onto a dfu type device | 2 # Convenience script for loading firmware onto a dfu type device |
3 # By default, initiates dfu-util | 3 # By default, initiates dfu-util |
4 | 4 |
5 SERIAL_PORT="" | 5 SERIAL_PORT="/dev/kiibohd" |
6 AUTO_SCREEN_SESSION="" | 6 AUTO_SCREEN_SESSION="/dev/kiibohd" |
7 NOSCREEN=0 | |
7 PROG_NAME=$(basename $0) | 8 PROG_NAME=$(basename $0) |
8 | 9 |
9 # Parse all the command line arguments | 10 # Parse all the command line arguments |
10 while (( "$#" >= "1" )); do | 11 while (( "$#" >= "1" )); do |
11 # Scan each argument | 12 # Scan each argument |
15 AUTO_SCREEN_SESSION="$2" | 16 AUTO_SCREEN_SESSION="$2" |
16 shift | 17 shift |
17 ;; | 18 ;; |
18 -f|--fastload) | 19 -f|--fastload) |
19 SERIAL_PORT="$2" | 20 SERIAL_PORT="$2" |
21 shift | |
22 ;; | |
23 -n|--noscreen) | |
24 NOSCREEN=1 | |
20 shift | 25 shift |
21 ;; | 26 ;; |
22 -h|--help) | 27 -h|--help) |
23 echo "Usage: $PROG_NAME [options...]" | 28 echo "Usage: $PROG_NAME [options...]" |
24 echo "" | 29 echo "" |
47 # If a SERIAL_PORT was specified set the uC into reflash mode | 52 # If a SERIAL_PORT was specified set the uC into reflash mode |
48 # XXX May not be successful if uC is not in a good state (or does not allow remote flashing) | 53 # XXX May not be successful if uC is not in a good state (or does not allow remote flashing) |
49 if [[ "$SERIAL_PORT" != "" ]] && [[ -e "$SERIAL_PORT" ]]; then | 54 if [[ "$SERIAL_PORT" != "" ]] && [[ -e "$SERIAL_PORT" ]]; then |
50 echo "NOTE: This may fail if the uC is in a bad state or does not support remote flashing" | 55 echo "NOTE: This may fail if the uC is in a bad state or does not support remote flashing" |
51 printf "reload\r" > $SERIAL_PORT | 56 printf "reload\r" > $SERIAL_PORT |
52 sleep 2 | |
53 fi | 57 fi |
54 | 58 |
55 # Load via dfu-util | 59 # Load via dfu-util |
56 # Used for McHCK based uCs | 60 # Used for McHCK based uCs |
57 if type dfu-util &>/dev/null; then | 61 if type dfu-util &>/dev/null; then |
62 # Wait for device to appear | |
63 while true; do | |
64 dfu-util -l | grep -q "Kiibohd DFU" | |
65 if [ $? -eq 0 ]; then | |
66 break | |
67 fi | |
68 sleep 0.1 | |
69 done | |
58 dfu-util -D @TARGET_BIN@ | 70 dfu-util -D @TARGET_BIN@ |
59 EXIT_STATUS=$? | 71 EXIT_STATUS=$? |
60 else | 72 else |
61 echo "dfu-util is required to reprogram the device" | 73 echo "dfu-util is required to reprogram the device" |
62 exit 3 | 74 exit 3 |
63 fi | 75 fi |
64 | 76 |
65 # Load Screen Session if specified | 77 # Load Screen Session if specified |
66 if (( "$EXIT_STATUS" == "0" )) && [[ "$AUTO_SCREEN_SESSION" != "" ]]; then | 78 if (( "$EXIT_STATUS" == "0" )) && [[ "$AUTO_SCREEN_SESSION" != "" ]] && [[ $NOSCREEN -ne 1 ]]; then |
67 if type screen &>/dev/null; then | 79 if type screen &>/dev/null; then |
68 sleep 0.1 | 80 # Wait for interface |
81 while [ ! -e $AUTO_SCREEN_SESSION ]; do | |
82 sleep 0.1 | |
83 done | |
69 screen $AUTO_SCREEN_SESSION | 84 screen $AUTO_SCREEN_SESSION |
70 else | 85 else |
71 echo "screen is not installed" | 86 echo "screen is not installed" |
72 exit 3 | 87 exit 3 |
73 fi | 88 fi |