Squashed 'panda/' content from commit ae816c104

git-subtree-dir: panda
git-subtree-split: ae816c104a99a8cd4d508ccd6abdc7b93053529c
This commit is contained in:
Vehicle Researcher
2019-06-28 21:09:12 +00:00
commit dba8e01e54
322 changed files with 61961 additions and 0 deletions
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+33
View File
@@ -0,0 +1,33 @@
#!/usr/bin/env python
from __future__ import print_function
import sys
import time
import usb1
def enter_download_mode(device):
handle = device.open()
handle.claimInterface(0)
try:
handle.controlWrite(usb1.TYPE_VENDOR | usb1.RECIPIENT_DEVICE, 0xd1, 0, 0, b'')
except (usb1.USBErrorIO, usb1.USBErrorPipe) as e:
print("Device download mode enabled.")
time.sleep(1)
else:
print("Device failed to enter download mode.")
sys.exit(1)
def find_first_panda(context=None):
context = context or usb1.USBContext()
for device in context.getDeviceList(skip_on_error=True):
if device.getVendorID() == 0xbbaa and device.getProductID()&0xFF00 == 0xdd00:
return device
if __name__ == "__main__":
panda_dev = find_first_panda()
if panda_dev == None:
print("no device found")
sys.exit(0)
print("found device")
enter_download_mode(panda_dev)