Coder Social home page Coder Social logo

Comments (4)

tlyu avatar tlyu commented on May 23, 2024 1

No. #112 is a related issue with receiving ZLPs in non-control transactions, very likely fixed by the combination of arduino/Arduino#6886 and keyboardio/Kaleidoscope-Bundle-Keyboardio#51. Note that arduino/Arduino#6886 seems to have been stalled for years due to lack of a signed CLA.

from arduinocore-avr.

per1234 avatar per1234 commented on May 23, 2024

Hi @tlyu. Thanks for your report! Is this the same bug that was previously reported here: #112 ?

from arduinocore-avr.

tlyu avatar tlyu commented on May 23, 2024

Minimal test case: With an Arduino Micro, edit the USB product string in boards.txt to be

Arduino Micro f0123456789abcdef

which is 31 ASCII characters long, and produces a string descriptor exactly 64 bytes long. Compile and upload any sketch that enables the CDC interface (it's enabled by default, I think). That will demonstrate the bug.

I've tested the above case via manual control read on macOS of more bytes than are in the descriptor. On Windows, there is a 5-second timeout on an initial attempt to fetch the string descriptor by requesting 255 bytes. Subsequent requests for the string descriptor do provide correct lengths, and succeed.

(For a HID report descriptor, a timeout will cause Windows to ignore that HID interface, but that's harder to produce a minimal test case for.)

from arduinocore-avr.

tlyu avatar tlyu commented on May 23, 2024

Demo script, using the Python usb1 module (requires libusb):

import usb1

with usb1.USBContext() as uc:
    # uc.setDebug(usb1.LOG_LEVEL_DEBUG)
    dh = uc.openByVendorIDAndProductID(0x2341, 0x8037)
    b1 = dh.controlRead(0x80, 6, 0x0302, 0, 64, 100)
    print(f"requested 64 bytes, got {len(b1)}")
    b2 = dh.controlRead(0x80, 6, 0x0302, 0, 255, 100)
    print(f"requested 255 bytes, got {len(b2)}")

Failure output:

requested 64 bytes, got 64
Traceback (most recent call last):
  File "/Users/tlyu/src/py-hid-utils/avrdesc-demo.py", line 8, in <module>
    b2 = dh.controlRead(0x80, 6, 0x0302, 0, 255, 100)
  File "/Users/tlyu/src/keyboardio/.venv/lib/python3.10/site-packages/usb1/__init__.py", line 1350, in controlRead
    transferred = self._controlTransfer(
  File "/Users/tlyu/src/keyboardio/.venv/lib/python3.10/site-packages/usb1/__init__.py", line 1307, in _controlTransfer
    mayRaiseUSBError(result)
  File "/Users/tlyu/src/keyboardio/.venv/lib/python3.10/site-packages/usb1/__init__.py", line 127, in mayRaiseUSBError
    __raiseUSBError(value)
  File "/Users/tlyu/src/keyboardio/.venv/lib/python3.10/site-packages/usb1/__init__.py", line 119, in raiseUSBError
    raise __STATUS_TO_EXCEPTION_DICT.get(value, __USBError)(value)
usb1.USBErrorTimeout: LIBUSB_ERROR_TIMEOUT [-7]

Verbose fail log (debug logging): avrdesc-fail-long.txt

from arduinocore-avr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.