X-Git-Url: https://git.donarmstrong.com/?p=kiibohd-kll.git;a=blobdiff_plain;f=backends%2Fkiibohd.py;h=71eb6dac9b15974ab937cb73a1569e9112d00435;hp=b29c465bb158832afb12fa92db9e421b10e91f08;hb=92f5705a620a42fd47a4d4b5d186b95eb244d7a8;hpb=1454611c7b9b4b930566a8fbf1783c66924f142b diff --git a/backends/kiibohd.py b/backends/kiibohd.py index b29c465..71eb6da 100644 --- a/backends/kiibohd.py +++ b/backends/kiibohd.py @@ -109,6 +109,12 @@ class Backend: # Add the result macro capability index guide (including capability arguments) # See kiibohd controller Macros/PartialMap/kll.h for exact formatting details for sequence in range( 0, len( macros.resultsIndexSorted[ result ] ) ): + # If the sequence is longer than 1, prepend a sequence spacer + # Needed for USB behaviour, otherwise, repeated keys will not work + if sequence > 0: + # , , + self.fill_dict['ResultMacros'] += "1, {0}, 0x00, ".format( capabilities.getIndex( self.usbCodeCapability() ) ) + # For each combo in the sequence, add the length of the combo self.fill_dict['ResultMacros'] += "{0}, ".format( len( macros.resultsIndexSorted[ result ][ sequence ] ) ) @@ -123,6 +129,12 @@ class Backend: for arg in range( 0, len( resultItem[1] ) ): self.fill_dict['ResultMacros'] += "0x{0:02X}, ".format( resultItem[1][ arg ] ) + # If sequence is longer than 1, append a sequence spacer at the end of the sequence + # Required by USB to end at sequence without holding the key down + if len( macros.resultsIndexSorted[ result ] ) > 1: + # , , + self.fill_dict['ResultMacros'] += "1, {0}, 0x00, ".format( capabilities.getIndex( self.usbCodeCapability() ) ) + # Add list ending 0 and end of list self.fill_dict['ResultMacros'] += "0 };\n" self.fill_dict['ResultMacros'] = self.fill_dict['ResultMacros'][:-1] # Remove last newline