diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4538604..b827e22 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,18 +2,18 @@ # See https://pre-commit.com/hooks.html for more hooks repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v3.2.0 + rev: v4.6.0 hooks: - id: trailing-whitespace - id: check-yaml - id: check-added-large-files - id: check-merge-conflict - repo: https://github.com/hhatto/autopep8 - rev: v2.0.4 + rev: v2.3.1 hooks: - id: autopep8 - repo: https://github.com/pylint-dev/pylint - rev: v3.0.2 + rev: v3.2.5 hooks: - id: pylint - repo: https://github.com/pre-commit/mirrors-clang-format diff --git a/README.md b/README.md index b53f3ff..0f72d45 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ The following examples have been confirmed working: **DISCLAIMER** : current results for the [highly-stressed stress test of Facedancer](https://github.com/greatscottgadgets/facedancer/blob/main/test/test_stress.py) with 20000 tries. -The current Facedancer stress test results are the following. +The current Facedancer stress test results are the following. * USB2 High-Speed * bulk IN/ctrl IN : pass * bulk OUT/ctrl OUT : fails after a few hundred/thousand tries, never reaches 20000 @@ -25,6 +25,8 @@ We are currently working on fixing those issues and we have a few culprits in mi * missed interrupts : the main culprit for now, it puts Hydradancer in a blocked state. * differences between HS/FS : HS has PING packets which reduces the amount of data transfers for OUT transactions. Since there are no FS examples from WCH and no indications in the datasheet, we experimented to solve this issue. +We implemented a [firmware](https://github.com/hydrausb3/wch-ch56x-lib/tree/main/tests/test_firmware_usb_stress_test) to test the USB2 implementation of `wch-ch56x-lib` with the same stress test and it passes with 100000 tries in both HS and FS. However, Hydradancer's firmware is more complex (more interrupts, USB3 and USB2 at the same time, delays to synchronize with Facedancer). + # Getting started (Hydradancer dongle) 1. To be able to access the HydraDancer boards and flash them, root privileges may be required, or you can provide them to your regular user, e.g. with the creation of a file `/etc/udev/rules.d/99-hydradancer.rules` with @@ -44,7 +46,7 @@ and having your user as member of the group `plugdev`. First ``` -Put the Hydradancer dongle in firmware download mode. For that, you need the following buttons : +Put the Hydradancer dongle in firmware download mode. For that, you need the following buttons : * reset : button with "RST" next to it * flash mode : button with "Flash Mode" next to it @@ -219,7 +221,7 @@ hydradancer/ | ├─ firmware_hydradancer # firmware for the Hydradancer dongle | ├─ legacy/ # old HydraUSB3 firmwares, unmaintained | ├─ tests/ # test firmwares to create various USB devices -| | ├─ test_backend # Not up-to-date. Test a Facedancer-like configuration, but without Facedancer. +| | ├─ test_backend # Not up-to-date. Test a Facedancer-like configuration, but without Facedancer. | | ├─ native/ # C programs using libusb to interact with the test firmwares | | ├─ scripts/ # Python scripts using pyusb to interact with the test firmwares tools/ diff --git a/hydradancer/tests/scripts/test_hspi_serdes.py b/hydradancer/tests/scripts/test_hspi_serdes.py index eab75d6..d5a88d7 100644 --- a/hydradancer/tests/scripts/test_hspi_serdes.py +++ b/hydradancer/tests/scripts/test_hspi_serdes.py @@ -51,8 +51,8 @@ def check(array_in): intf, find_all=True, # match the first OUT endpoint - custom_match=lambda e: \ - usb.util.endpoint_direction(e.bEndpointAddress) == \ + custom_match=lambda e: + usb.util.endpoint_direction(e.bEndpointAddress) == usb.util.ENDPOINT_IN)) assert ep_in is not None diff --git a/hydradancer/tests/scripts/test_loopback.py b/hydradancer/tests/scripts/test_loopback.py index ada117a..42d4b8c 100644 --- a/hydradancer/tests/scripts/test_loopback.py +++ b/hydradancer/tests/scripts/test_loopback.py @@ -79,16 +79,16 @@ def send_next_packet(head, ep_in, ep_out, endp_max_packet_size, buffer_in, buffe intf, find_all=True, # match the first OUT endpoint - custom_match=lambda e: \ - usb.util.endpoint_direction(e.bEndpointAddress) == \ + custom_match=lambda e: + usb.util.endpoint_direction(e.bEndpointAddress) == usb.util.ENDPOINT_IN)) ep_out = list(usb.util.find_descriptor( intf, # match the first OUT endpoint find_all=True, - custom_match=lambda e: \ - usb.util.endpoint_direction(e.bEndpointAddress) == \ + custom_match=lambda e: + usb.util.endpoint_direction(e.bEndpointAddress) == usb.util.ENDPOINT_OUT)) assert ep_in is not None diff --git a/hydradancer/tests/scripts/test_loopback_randomize_packetsize.py b/hydradancer/tests/scripts/test_loopback_randomize_packetsize.py index 03113db..5fd49f8 100644 --- a/hydradancer/tests/scripts/test_loopback_randomize_packetsize.py +++ b/hydradancer/tests/scripts/test_loopback_randomize_packetsize.py @@ -85,16 +85,16 @@ def send_next_packet(head, ep_in, ep_out, endp_max_packet_size, buffer_in, buffe intf, find_all=True, # match the first OUT endpoint - custom_match=lambda e: \ - usb.util.endpoint_direction(e.bEndpointAddress) == \ + custom_match=lambda e: + usb.util.endpoint_direction(e.bEndpointAddress) == usb.util.ENDPOINT_IN)) ep_out = list(usb.util.find_descriptor( intf, # match the first OUT endpoint find_all=True, - custom_match=lambda e: \ - usb.util.endpoint_direction(e.bEndpointAddress) == \ + custom_match=lambda e: + usb.util.endpoint_direction(e.bEndpointAddress) == usb.util.ENDPOINT_OUT)) assert ep_in is not None diff --git a/hydradancer/tests/scripts/test_speedtest.py b/hydradancer/tests/scripts/test_speedtest.py index c0c9772..1f32b50 100644 --- a/hydradancer/tests/scripts/test_speedtest.py +++ b/hydradancer/tests/scripts/test_speedtest.py @@ -61,15 +61,15 @@ ep_in = usb.util.find_descriptor( intf, # match the first OUT endpoint - custom_match=lambda e: \ - usb.util.endpoint_direction(e.bEndpointAddress) == \ + custom_match=lambda e: + usb.util.endpoint_direction(e.bEndpointAddress) == usb.util.ENDPOINT_IN) ep_out = usb.util.find_descriptor( intf, # match the first OUT endpoint - custom_match=lambda e: \ - usb.util.endpoint_direction(e.bEndpointAddress) == \ + custom_match=lambda e: + usb.util.endpoint_direction(e.bEndpointAddress) == usb.util.ENDPOINT_OUT) assert ep_in is not None diff --git a/hydradancer/tests/scripts/test_speedtest_one_by_one.py b/hydradancer/tests/scripts/test_speedtest_one_by_one.py index 3f54b02..7d8fb92 100644 --- a/hydradancer/tests/scripts/test_speedtest_one_by_one.py +++ b/hydradancer/tests/scripts/test_speedtest_one_by_one.py @@ -64,15 +64,15 @@ ep_in = usb.util.find_descriptor( intf, # match the first OUT endpoint - custom_match=lambda e: \ - usb.util.endpoint_direction(e.bEndpointAddress) == \ + custom_match=lambda e: + usb.util.endpoint_direction(e.bEndpointAddress) == usb.util.ENDPOINT_IN) ep_out = usb.util.find_descriptor( intf, # match the first OUT endpoint - custom_match=lambda e: \ - usb.util.endpoint_direction(e.bEndpointAddress) == \ + custom_match=lambda e: + usb.util.endpoint_direction(e.bEndpointAddress) == usb.util.ENDPOINT_OUT) assert ep_in is not None