added support for multiple Bluetooth adapters

This commit is contained in:
Robert Martin
2020-03-31 00:18:38 +09:00
parent 26715f1be0
commit 44c684a224
5 changed files with 106 additions and 42 deletions
+6 -6
View File
@@ -14,9 +14,9 @@ from joycontrol.server import create_hid_server
logger = logging.getLogger(__name__)
async def _main(controller, capture_file=None, spi_flash=None):
async def _main(controller, capture_file=None, spi_flash=None, device_id=None):
factory = controller_protocol_factory(controller, spi_flash=spi_flash)
transport, protocol = await create_hid_server(factory, 17, 19, capture_file=capture_file)
transport, protocol = await create_hid_server(factory, 17, 19, capture_file=capture_file, device_id=device_id)
controller_state = protocol.get_controller_state()
@@ -39,6 +39,7 @@ if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('controller', help='JOYCON_R, JOYCON_L or PRO_CONTROLLER')
parser.add_argument('-l', '--log')
parser.add_argument('-d', '--device_id')
parser.add_argument('--spi_flash')
args = parser.parse_args()
@@ -71,7 +72,6 @@ if __name__ == '__main__':
with get_output(args.log) as capture_file:
loop = asyncio.get_event_loop()
loop.run_until_complete(_main(controller, capture_file=capture_file, spi_flash=spi_flash))
loop.run_until_complete(
_main(controller, capture_file=capture_file, spi_flash=spi_flash, device_id=args.device_id)
)