Skip to content

Commit

Permalink
Update pre-commit hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
kauwua committed Jul 20, 2024
1 parent 59c55d3 commit 47dc148
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 24 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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/
Expand Down
4 changes: 2 additions & 2 deletions hydradancer/tests/scripts/test_hspi_serdes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions hydradancer/tests/scripts/test_loopback.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions hydradancer/tests/scripts/test_speedtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions hydradancer/tests/scripts/test_speedtest_one_by_one.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 47dc148

Please sign in to comment.