File tree Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -1008,15 +1008,31 @@ async def stop_notify(self, characteristic: BleakGATTCharacteristic) -> None:
10081008 assert self ._bus is not None
10091009
10101010 if "NotifyAcquired" in characteristic .obj [1 ]:
1011+ logger .debug (
1012+ "Closing notification fd for characteristic %d" , characteristic .handle
1013+ )
10111014 fd = self ._notification_fds .pop (characteristic .obj [0 ], None )
1012- if fd is not None :
1015+
1016+ if fd is None :
1017+ logger .debug (
1018+ "No notification fd found for characteristic %d" ,
1019+ characteristic .handle ,
1020+ )
1021+ else :
10131022 loop = asyncio .get_running_loop ()
10141023 try :
10151024 loop .remove_reader (fd )
1025+ except RuntimeError :
1026+ # Run loop is closed
1027+ pass
1028+ try :
10161029 os .close (fd )
1017- except Exception as e :
1018- logger .debug ("Failed to remove file descriptor %d: %d " , fd , e )
1030+ except OSError as e :
1031+ logger .debug ("Failed to remove file descriptor %d: %s " , fd , e )
10191032 else :
1033+ logger .debug (
1034+ "Calling StopNotify for characteristic %d" , characteristic .handle
1035+ )
10201036 reply = await self ._bus .call (
10211037 Message (
10221038 destination = defs .BLUEZ_SERVICE ,
You can’t perform that action at this time.
0 commit comments