You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2022/02/04 12:47:56 UTC

[GitHub] [mynewt-core] kasjer commented on a change in pull request #2762: OSX support for detect_programmer

kasjer commented on a change in pull request #2762:
URL: https://github.com/apache/mynewt-core/pull/2762#discussion_r799433160



##########
File path: hw/scripts/common.sh
##########
@@ -88,6 +88,14 @@ 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
+        USB_DEV=$(system_profiler SPUSBDataType 2>/dev/null | awk '/^[ \t]+Product ID:/ { PID=$3 } /^[ \t]+Vendor ID:/ { printf("%s:%s\n", PID, $3) }')

Review comment:
       For me this line looks perfectly OK.
   I don't see anything that could be split.
   Same approach is use few line above where `lsusb` is piped to `cut` and here `system_profiler` is piped to `awk` in very nice way including error redirection to **/dev/null**
   
   I don't have OSX to check for system_profiler output but awk part is very clear and there is no single character I would written better.
   @vrahane please reconsider




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org