Thanks to visit codestin.com
Credit goes to github.com

Skip to content

MemoryError while trying to display device.manufacturer or device.product. #2

Open
@dglaude

Description

@dglaude

I tested up to 10 differents USB devices without problem.
But one of my device is resisiting and crashing with a MemoryError when trying to display:
device.manufacturer
and when trying to display:
device.product

Not sure what is going on, but there is something wrong.

searching for devices
pid 0x2303
vid 0x67b
Traceback (most recent call last):
  File "code.py", line 18, in <module>
MemoryError: memory allocation failed, allocating 2147483647 bytes

Code done running.

The offending line is line 18, but if I comment out that line, I have the same error and memory allocation for line 19.

        print("pid", hex(device.idProduct))
        print("vid", hex(device.idVendor))
#        print("man", device.manufacturer)
#        print("product", device.product)
        print("serial", device.serial_number)
        print("config[0]:")

Only if I remove both line like above, can I get some proper output:

Code stopped by auto-reload. Reloading soon.
soft reboot

Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
searching for devices
pid 0x2303
vid 0x67b
serial None
config[0]:
 value 1
 interface[0]
  class ff subclass 00
  IN 81
  OUT 02
  IN 83


Code stopped by auto-reload. Reloading soon.
soft reboot

Notice that the code stop and restart in loop.
This is not consistent with the usual waiting loop that is more like this:

searching for devices
searching for devices
searching for devices

When plugging that same device in my Linux, it behave well and we can see the manufacturer and product:

[46203.061185] usb 3-3: new full-speed USB device number 34 using xhci_hcd
[46203.209942] usb 3-3: New USB device found, idVendor=067b, idProduct=2303, bcdDevice= 4.00
[46203.209957] usb 3-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[46203.209963] usb 3-3: Product: USB-Serial Controller D
[46203.209967] usb 3-3: Manufacturer: Prolific Technology Inc.
[46203.236186] usbcore: registered new interface driver usbserial_generic
[46203.236203] usbserial: USB Serial support registered for generic
[46203.239716] usbcore: registered new interface driver pl2303
[46203.239731] usbserial: USB Serial support registered for pl2303
[46203.239749] pl2303 3-3:1.0: pl2303 converter detected
[46203.241740] usb 3-3: pl2303 converter now attached to ttyUSB0

CP displayed without problem another Prolific Technology Inc. device "USB to Parallel" but was not happy with my "USB to Serial". It worked also with another USB to Serial that was not from Prolific.
So it is a problem just with one particular device.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions