You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by vi...@apache.org on 2022/02/07 17:42:08 UTC
[mynewt-core] branch master updated: OSX support for detect_programmer
This is an automated email from the ASF dual-hosted git repository.
vipulrahane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git
The following commit(s) were added to refs/heads/master by this push:
new c0a8ca3 OSX support for detect_programmer
new d1c2ff8 Merge pull request #2762 from cqexbesd/detect_programmer_osx
c0a8ca3 is described below
commit c0a8ca3978ac56b866e029c721abdca59f5d0d24
Author: Andrew Stevenson <an...@ugh.net.au>
AuthorDate: Mon Jan 31 00:02:00 2022 +0100
OSX support for detect_programmer
---
hw/scripts/common.sh | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/hw/scripts/common.sh b/hw/scripts/common.sh
index e987cfe..f0bc46c 100755
--- a/hw/scripts/common.sh
+++ b/hw/scripts/common.sh
@@ -88,6 +88,27 @@ detect_programmer() {
# extract the VID:PID list for connected USB devices
USB_DEV=$(lsusb | cut -f6 -d' ')
+ elif [ $(which system_profiler) ] ; then
+
+ # extract the VID:PID list for connected USB devices on OSX
+ # and get them in the same format as lsusb from Linux
+ USB_DEV=$(system_profiler SPUSBDataType 2>/dev/null | awk '
+ /^[ \t]+Product ID:/ {
+ # remove leading 0x from hex number
+ sub(/^0x/, "", $3);
+ PID=$3;
+ }
+ /^[ \t]+Vendor ID:/ {
+ # remove leading 0x from hex number
+ sub(/^0x/, "", $3);
+ printf("%s:%s\n", PID, $3);
+ }
+ ')
+
+ fi
+
+ if [ -n "$USB_DEV" ]; then
+
echo "$USB_DEV" | grep -q -i 'c251:f001'
[ $? -eq 0 ] && DETECTED_PROGRAMMER='cmsis-dap'