]> git.donarmstrong.com Git - kiibohd-kll.git/blobdiff - backends/kiibohd.py
Adding a few more mouse tests
[kiibohd-kll.git] / backends / kiibohd.py
index 70fd58c8e7c97dae0a121c36ed6223cf4fc974ca..d4f1e55ab3d2d22e582c120c6f2c4ee8b2684c62 100644 (file)
@@ -176,11 +176,16 @@ class Backend( BackendBase ):
                                                # Special cases
                                                if isinstance( resultItem[1][ arg ], str ):
                                                        # If this is a CONSUMER_ element, needs to be split into 2 elements
-                                                       if re.match( '^CONSUMER_', resultItem[1][ arg ] ):
+                                                       # AC_ and AL_ are other sections of consumer control
+                                                       if re.match( '^(CONSUMER|AC|AL)_', resultItem[1][ arg ] ):
                                                                tag = resultItem[1][ arg ].split( '_', 1 )[1]
                                                                if '_' in tag:
                                                                        tag = tag.replace( '_', '' )
-                                                               lookupNum = kll_hid_lookup_dictionary['ConsCode'][ tag ][1]
+                                                               try:
+                                                                       lookupNum = kll_hid_lookup_dictionary['ConsCode'][ tag ][1]
+                                                               except KeyError as err:
+                                                                       print ( "{0} {1} Consumer HID kll bug...please report.".format( ERROR, err ) )
+                                                                       raise
                                                                byteForm = lookupNum.to_bytes( 2, byteorder='little' ) # XXX Yes, little endian from how the uC structs work
                                                                self.fill_dict['ResultMacros'] += "{0}, {1}, ".format( *byteForm )
                                                                continue