Fix nop and usb kernel issues

This commit is contained in:
Bjoern Kerler 2022-06-16 11:05:29 +02:00
parent 941e86ea1a
commit b208e3edd6
No known key found for this signature in database
GPG key ID: 52E823BB96A55380
2 changed files with 18 additions and 5 deletions

10
edl
View file

@ -310,11 +310,11 @@ class main(metaclass=LogBase):
self.cdc.timeout = None
sahara_info = self.sahara.streaminginfo()
if sahara_info:
sahara_connnect = self.sahara.connect()
if len(sahara_connnect) == 3:
mode, cmd, resp = sahara_connnect
else:
mode, resp = sahara_connnect
sahara_connect = self.sahara.connect()
if len(sahara_connect) == 3:
mode, cmd, resp = sahara_connect
else:
mode, resp = sahara_connect
if mode == "sahara":
mode = self.sahara.upload_loader()
if "enprg" in self.sahara.programmer.lower():

View file

@ -255,6 +255,18 @@ class usb_class(DeviceClass):
if self.EP_OUT is not None and self.EP_IN is not None:
self.maxsize = self.EP_IN.wMaxPacketSize
try:
if self.device.is_kernel_driver_active(0):
self.debug("Detaching kernel driver")
self.device.detach_kernel_driver(0)
except Exception as err:
self.debug("No kernel driver supported: " + str(err))
try:
usb.util.claim_interface(self.device, 0)
except:
pass
"""
self.debug(self.configuration)
if self.interface != 0:
try:
@ -284,6 +296,7 @@ class usb_class(DeviceClass):
usb.util.claim_interface(self.device, self.interface)
except:
pass
"""
self.connected = True
return True
print("Couldn't find CDC interface. Aborting.")