1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2026-01-01 01:41:18 +01:00

Merge pull request #18525 from maribu/makefiles/tools/serial.inc.mk

makefiles/tools/serial.inc.mk: Improve PORT selection when RIOT's USB CDC ACM is used for stdio
This commit is contained in:
Marian Buschsieweke 2022-08-30 09:05:17 +02:00 committed by GitHub
commit 1d5e5a423d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 8 deletions

View File

@ -213,11 +213,14 @@ def print_ttys(args):
ttys.append(tty)
if args.most_recent:
most_recent = ttys[0]
for tty in ttys:
if tty["ctime"] > most_recent["ctime"]:
most_recent = tty
ttys = [most_recent]
if len(ttys) > 0:
most_recent = ttys[0]
for tty in ttys:
if tty["ctime"] > most_recent["ctime"]:
most_recent = tty
ttys = [most_recent]
else:
ttys = []
print_results(args, ttys)

View File

@ -1,7 +1,11 @@
# Select the most recently attached tty interface
ifeq (1,$(MOST_RECENT_PORT))
ifneq (,$(filter stdio_cdc_acm,$(USEMODULE)))
TTY_BOARD_FILTER ?= --model $(BOARD) --vendor 'RIOT-os\.org'
endif
TTYS_FLAGS := --most-recent --format path $(TTY_BOARD_FILTER)
PORT ?= $(shell $(RIOTTOOLS)/usb-serial/ttys.py $(TTYS_FLAGS))
PORT_DETECTED := $(shell $(RIOTTOOLS)/usb-serial/ttys.py $(TTYS_FLAGS))
PORT ?= $(PORT_DETECTED)
endif
# Otherwise, use as default the most commonly used ports on Linux and OSX
PORT_LINUX ?= /dev/ttyACM0

View File

@ -86,7 +86,7 @@ extern "C" {
* @brief USB peripheral product string
*/
#ifndef CONFIG_USB_PRODUCT_STR
#define CONFIG_USB_PRODUCT_STR "USB device"
#define CONFIG_USB_PRODUCT_STR RIOT_BOARD
#endif
/**

View File

@ -62,7 +62,7 @@ config USB_MANUF_STR
config USB_PRODUCT_STR
string "Product string"
default "USB device"
default BOARD
config USB_CONFIGURATION_STR
string "Configuration string"