Compare commits

...

6 Commits

Author SHA1 Message Date
Maxime Desroches d92b0156f0
Merge b1ffee7abc into 5761ab58ea 2024-11-24 13:50:55 +00:00
Adeeb Shihadeh 5761ab58ea what was that doing there? 2024-11-22 19:33:04 -08:00
Willem Melching cfbc3ff835
Ensure auto switching FD is off in Python (#2087) 2024-11-22 10:29:11 -08:00
Maxime Desroches b1ffee7abc enum 2024-09-23 18:27:43 -07:00
Maxime Desroches 2b148c003d remove that 2024-09-23 18:27:43 -07:00
Maxime Desroches 94418fd7e7 more 2024-09-23 18:27:43 -07:00
4 changed files with 9 additions and 26 deletions

View File

@ -7,8 +7,10 @@
#define PULL_UP 1
#define PULL_DOWN 2
#define OUTPUT_TYPE_PUSH_PULL 0U
#define OUTPUT_TYPE_OPEN_DRAIN 1U
enum {
OUTPUT_TYPE_PUSH_PULL = 0U,
OUTPUT_TYPE_OPEN_DRAIN = 1U,
};
typedef struct {
GPIO_TypeDef * const bank;

View File

@ -30,16 +30,10 @@ void refresh_can_tx_slots_available(void);
// **** supporting defines ****
#define USB_REQ_GET_STATUS 0x00
#define USB_REQ_CLEAR_FEATURE 0x01
#define USB_REQ_SET_FEATURE 0x03
#define USB_REQ_SET_ADDRESS 0x05
#define USB_REQ_GET_DESCRIPTOR 0x06
#define USB_REQ_SET_DESCRIPTOR 0x07
#define USB_REQ_GET_CONFIGURATION 0x08
#define USB_REQ_SET_CONFIGURATION 0x09
#define USB_REQ_GET_INTERFACE 0x0A
#define USB_REQ_SET_INTERFACE 0x0B
#define USB_REQ_SYNCH_FRAME 0x0C
#define USB_DESC_TYPE_DEVICE 0x01
#define USB_DESC_TYPE_CONFIGURATION 0x02
@ -47,7 +41,6 @@ void refresh_can_tx_slots_available(void);
#define USB_DESC_TYPE_INTERFACE 0x04
#define USB_DESC_TYPE_ENDPOINT 0x05
#define USB_DESC_TYPE_DEVICE_QUALIFIER 0x06
#define USB_DESC_TYPE_OTHER_SPEED_CONFIGURATION 0x07
#define USB_DESC_TYPE_BINARY_OBJECT_STORE 0x0f
// offsets for configuration strings
@ -56,22 +49,12 @@ void refresh_can_tx_slots_available(void);
#define STRING_OFFSET_IPRODUCT 0x02
#define STRING_OFFSET_ISERIAL 0x03
#define STRING_OFFSET_ICONFIGURATION 0x04
#define STRING_OFFSET_IINTERFACE 0x05
// WebUSB requests
#define WEBUSB_REQ_GET_URL 0x02
// WebUSB types
#define WEBUSB_DESC_TYPE_URL 0x03
#define WEBUSB_URL_SCHEME_HTTPS 0x01
#define WEBUSB_URL_SCHEME_HTTP 0x00
// WinUSB requests
#define WINUSB_REQ_GET_COMPATID_DESCRIPTOR 0x04
#define WINUSB_REQ_GET_EXT_PROPS_OS 0x05
#define WINUSB_REQ_GET_DESCRIPTOR 0x07
#define STS_GOUT_NAK 1
#define STS_DATA_UPDT 2
#define STS_XFER_COMP 3
#define STS_SETUP_COMP 4

View File

@ -2,21 +2,15 @@
import os
import time
import subprocess
import argparse
from panda import Panda, PandaDFU
board_path = os.path.dirname(os.path.realpath(__file__))
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--all", action="store_true", help="Recover all Panda devices")
args = parser.parse_args()
subprocess.check_call(f"scons -C {board_path}/.. -j$(nproc) {board_path}", shell=True)
serials = Panda.list() if args.all else [None]
for s in serials:
for s in Panda.list():
with Panda(serial=s) as p:
print(f"putting {p.get_usb_serial()} in DFU mode")
p.reset(enter_bootstub=True)

View File

@ -324,6 +324,10 @@ class Panda:
# reset comms
self.can_reset_communications()
# disable automatic CAN-FD switching
for bus in range(PANDA_BUS_CNT):
self.set_canfd_auto(bus, False)
# set CAN speed
for bus in range(PANDA_BUS_CNT):
self.set_can_speed_kbps(bus, self._can_speed_kbps)