File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -39,7 +39,6 @@ async def find_device(
3939 asyncio.TimeoutError:
4040 Device was not found within the timeout.
4141 """
42- print (f"Searching for { name or service } " )
4342
4443 def match_uuid_and_name (device : BLEDevice , adv : AdvertisementData ):
4544 if service not in adv .service_uuids :
Original file line number Diff line number Diff line change @@ -144,7 +144,9 @@ async def run(self, args: argparse.Namespace):
144144 elif args .conntype == "ble" :
145145 # It is a Pybricks Hub with BLE. Device name or address is given.
146146 hub = PybricksHub ()
147+ print (f"Searching for { args .name or 'any hub with Pybricks service' } ..." )
147148 device_or_address = await find_device (args .name )
149+
148150 elif args .conntype == "usb" and args .name == "lego" :
149151 # It's LEGO stock firmware Hub with USB.
150152 hub = USBRPCConnection ()
@@ -195,7 +197,14 @@ async def run(self, args: argparse.Namespace):
195197 from ..ble import find_device
196198 from ..flash import BootloaderConnection
197199
198- device = await find_device (service = LWP3_BOOTLOADER_SERVICE_UUID )
200+ print ("Searching for LEGO Bootloader..." )
201+
202+ try :
203+ device = await find_device (service = LWP3_BOOTLOADER_SERVICE_UUID )
204+ except asyncio .TimeoutError :
205+ print ("timed out" )
206+ return
207+
199208 print ("Found:" , device )
200209 updater = BootloaderConnection ()
201210 await updater .connect (device )
You can’t perform that action at this time.
0 commit comments