Skip to content

Commit

Permalink
Catch spurious ENODEVs on DFU detach
Browse files Browse the repository at this point in the history
Signed-off-by: Romain Gantois <romain.gantois@bootlin.com>
  • Loading branch information
rgantois committed Aug 30, 2023
1 parent 5012f37 commit 50522e5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/snagrecover/protocols/dfu.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import time
import logging
logger = logging.getLogger("snagrecover")
from errno import EIO
from errno import EIO,ENODEV
from snagrecover import utils

def search_partid(dev: usb.core.Device, partname: str, match_prefix=False) -> int:
Expand Down Expand Up @@ -166,8 +166,8 @@ def detach(self, partid: int):
try:
self.dev.ctrl_transfer(0xa1, 0, wValue=0x7530, wIndex=0, data_or_wLength=0)
except usb.core.USBError as e:
if e.errno == EIO:
logger.warning("EIO on DFU_DETACH")
if e.errno in [EIO, ENODEV]:
logger.warning(f"EIO or ENODEV: {e.errno} on DFU_DETACH")
else:
raise e
return None
Expand Down

0 comments on commit 50522e5

Please sign in to comment.