Skip to content

Commit aefed91

Browse files
authored
Merge pull request #991 from patrislav1/atmelice_sam4l
Fix Atmel-ICE compatibility issue
2 parents 9ab3891 + 320b19c commit aefed91

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

pyocd/probe/pydapaccess/interface/pyusb_backend.py

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# pyOCD debugger
22
# Copyright (c) 2006-2020 Arm Limited
3+
# Copyright (c) 2020 Patrick Huesmann
34
# SPDX-License-Identifier: Apache-2.0
45
#
56
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -271,14 +272,25 @@ def __call__(self, interface):
271272
# Must have either 1 or 2 endpoints.
272273
if interface.bNumEndpoints not in (1, 2):
273274
return False
274-
275-
# Endpoint 0 must be interrupt in.
276-
if not check_ep(interface, 0, usb.util.ENDPOINT_IN, usb.util.ENDPOINT_TYPE_INTR):
277-
return False
278-
279-
# Endpoint 1 is optional. If present it must be interrupt out.
280-
if (interface.bNumEndpoints == 2) \
281-
and not check_ep(interface, 1, usb.util.ENDPOINT_OUT, usb.util.ENDPOINT_TYPE_INTR):
275+
276+
endpoint_attrs = [
277+
(usb.util.endpoint_direction(ep.bEndpointAddress),
278+
usb.util.endpoint_type(ep.bmAttributes))
279+
for ep in interface
280+
]
281+
282+
# Possible combinations of endpoints
283+
ENDPOINT_ATTRS_ALLOWED = [
284+
# One interrupt endpoint IN
285+
[(usb.util.ENDPOINT_IN, usb.util.ENDPOINT_TYPE_INTR)],
286+
# Two interrupt endpoints, first one IN, second one OUT
287+
[(usb.util.ENDPOINT_IN, usb.util.ENDPOINT_TYPE_INTR),
288+
(usb.util.ENDPOINT_OUT, usb.util.ENDPOINT_TYPE_INTR)],
289+
# Two interrupt endpoints, first one OUT, second one IN
290+
[(usb.util.ENDPOINT_OUT, usb.util.ENDPOINT_TYPE_INTR),
291+
(usb.util.ENDPOINT_IN, usb.util.ENDPOINT_TYPE_INTR)],
292+
]
293+
if endpoint_attrs not in ENDPOINT_ATTRS_ALLOWED:
282294
return False
283295

284296
# All checks passed, this is a CMSIS-DAPv2 interface!

udev/50-cmsis-dap.rules

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ SUBSYSTEM=="usb", ATTR{idVendor}=="c251", ATTR{idProduct}=="2750", MODE:="666"
77
# 1fc9:0090 NXP LPC-LinkII
88
SUBSYSTEM=="usb", ATTR{idVendor}=="1fc9", ATTR{idProduct}=="0090", MODE:="666"
99

10+
# 03eb:2141 Atmel-ICE CMSIS-DAP
11+
SUBSYSTEM=="usb", ATTR{idVendor}=="03eb", ATTR{idProduct}=="2141", MODE:="666"

0 commit comments

Comments
 (0)