Process command line arguments
( self )
| 443 | sys.exit( 1 ) |
| 444 | |
| 445 | def process_args( self ): |
| 446 | ''' |
| 447 | Process command line arguments |
| 448 | ''' |
| 449 | # Setup argument processor |
| 450 | parser = argparse.ArgumentParser( |
| 451 | usage="%(prog)s [options..]", |
| 452 | description="Kiibohd Host KLL Implementation", |
| 453 | epilog="Example: {0} TODO".format( os.path.basename( sys.argv[0] ) ), |
| 454 | formatter_class=argparse.RawTextHelpFormatter, |
| 455 | add_help=False, |
| 456 | ) |
| 457 | |
| 458 | # Optional Arguments |
| 459 | parser.add_argument( '-h', '--help', |
| 460 | action="help", |
| 461 | help="This message." |
| 462 | ) |
| 463 | parser.add_argument( '-c', '--cli', |
| 464 | action="store_true", |
| 465 | help="Enables virtual serial port interface." |
| 466 | ) |
| 467 | parser.add_argument( '-d', '--debug', |
| 468 | action="store_true", |
| 469 | help="Enable debug mode." |
| 470 | ) |
| 471 | parser.add_argument( '-t', '--test', |
| 472 | action="store_true", |
| 473 | help="Run small test function to validate that Python callback interface is working." |
| 474 | ) |
| 475 | |
| 476 | # Process Arguments |
| 477 | args = parser.parse_args() |
| 478 | |
| 479 | # Enable debug mode |
| 480 | self.debug = args.debug |
| 481 | scan.debug = args.debug |
| 482 | output.debug = args.debug |
| 483 | |
| 484 | # Enable virtual serial port |
| 485 | if args.cli: |
| 486 | logger.info("Enabling Virtual Serial Port") |
| 487 | self.virtual_serialport_setup() |
| 488 | |
| 489 | # Run test if requested, then exit |
| 490 | if args.test: |
| 491 | logger.info("libkiibohd.so - Callback Test") |
| 492 | val = self.kiibohd.Host_callback_test() |
| 493 | logger.info("Return Value:", val ) |
| 494 | sys.exit( 0 ) |
| 495 | |
| 496 | return args |
| 497 | |
| 498 | def process( self ): |
| 499 | ''' |
no test coverage detected