diff --git a/tinygrad_repo/tinygrad/runtime/support/system.py b/tinygrad_repo/tinygrad/runtime/support/system.py index 9668a1d0c..bb47c77d5 100644 --- a/tinygrad_repo/tinygrad/runtime/support/system.py +++ b/tinygrad_repo/tinygrad/runtime/support/system.py @@ -220,7 +220,7 @@ class USBPCIDevice(PCIDevice): def __init__(self, devpref:str, dev, pcibus): self.pcibus, self.peer_group = pcibus, f"USBPCIDevice_{pcibus}" self.lock_fd = System.flock_acquire(f"{devpref.lower()}_{pcibus.lower()}.lock") - usb = USB3(dev, 0x81, 0x83, 0x02, 0x04, use_bot=True) + usb = USB3(dev, 0x81, 0x83, 0x02, 0x04) if DEBUG >= 1: print(f"am {self.pcibus}: product string: {usb.product!r}") self.usb: CustomASM24Controller | ASM24Controller = CustomASM24Controller(usb) if usb.is_custom else ASM24Controller(usb) self._bar_info = System.pci_setup_usb_bars(self.usb, gpu_bus=4, mem_base=0x10000000, pref_mem_base=(32 << 30)) diff --git a/tinygrad_repo/tinygrad/runtime/support/usb.py b/tinygrad_repo/tinygrad/runtime/support/usb.py index 54562b7a5..1ff0d936d 100644 --- a/tinygrad_repo/tinygrad/runtime/support/usb.py +++ b/tinygrad_repo/tinygrad/runtime/support/usb.py @@ -5,6 +5,10 @@ from tinygrad.helpers import DEBUG, DEV, to_mv, round_up, OSX, getenv, ceildiv from tinygrad.runtime.support.hcq import MMIOInterface from tinygrad.runtime.support import c +CUSTOM_ASM24_PRODUCT_PREFIXES = ("custom", "USB 3.2 PCIe TinyEnclosure") + +def is_custom_asm24_product(product:str) -> bool: return product.startswith(CUSTOM_ASM24_PRODUCT_PREFIXES) + def alloc_cbuffer(sz:int) -> tuple[ctypes.Array, memoryview]: return (buf:=(ctypes.c_ubyte * sz)()), to_mv(ctypes.addressof(buf), sz) def checked(fn, msg=None): @functools.wraps(fn) @@ -63,7 +67,7 @@ class USB3: checked(libusb.libusb_get_device_descriptor)(libusb.libusb_get_device(self.handle), ctypes.byref(_desc)) _ret = checked(libusb.libusb_get_string_descriptor_ascii)(self.handle, _desc.iProduct, _buf, 256) self.product = bytes(_buf[:_ret]).decode("ascii", errors="replace") - self.is_custom = self.product.startswith("custom") + self.is_custom = is_custom_asm24_product(self.product) if self.is_custom: self.use_bot = use_bot = True # Detach kernel driver if needed