Skip to content

Commit

Permalink
support: tests: added a usb_set_interface helper
Browse files Browse the repository at this point in the history
  • Loading branch information
lethalbit committed Jan 5, 2025
1 parent fcc2374 commit c2cde06
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions squishy/support/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,17 @@ def usb_set_addr(self, addr: int):
yield from self.usb_get_zlp()
yield from self.usb_send_ack()

def usb_set_interface(self, addr: int, interface: int, alt: int):
yield from self.usb_send_setup_pkt(addr, (
0x01, USBStandardRequests.SET_INTERFACE,
*alt.to_bytes(2, byteorder = 'little'),
*interface.to_bytes(2, byteorder = 'little'),
0x00, 0x00
))
yield from self.usb_in(addr, 0)
yield from self.usb_get_zlp()
yield from self.usb_send_ack()

def usb_set_config(self, addr: int, cfg: int):
yield from self.usb_send_setup_pkt(addr, (
0x00, USBStandardRequests.SET_CONFIGURATION,
Expand Down

0 comments on commit c2cde06

Please sign in to comment.