## Capabilities ##
+ self.fill_dict['CapabilitiesFuncDecl'] = ""
self.fill_dict['CapabilitiesList'] = "const Capability CapabilitiesList[] = {\n"
+ self.fill_dict['CapabilitiesIndices'] = "typedef enum CapabilityIndex {\n"
# Keys are pre-sorted
for key in capabilities.keys():
funcName = capabilities.funcName( key )
argByteWidth = capabilities.totalArgBytes( key )
self.fill_dict['CapabilitiesList'] += "\t{{ {0}, {1} }},\n".format( funcName, argByteWidth )
+ self.fill_dict['CapabilitiesFuncDecl'] += "void {0}( uint8_t state, uint8_t stateType, uint8_t *args );\n".format( funcName )
+ self.fill_dict['CapabilitiesIndices'] += "\t{0}_index,\n".format( funcName )
self.fill_dict['CapabilitiesList'] += "};"
+ self.fill_dict['CapabilitiesIndices'] += "} CapabilityIndex;"
## Results Macros ##
# 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