{"action":"created","issue":{"url":"https://api.github.com/repos/arduino/Arduino/issues/4230","labels_url":"https://api.github.com/repos/arduino/Arduino/issues/4230/labels{/name}","comments_url":"https://api.github.com/repos/arduino/Arduino/issues/4230/comments","events_url":"https://api.github.com/repos/arduino/Arduino/issues/4230/events","html_url":"https://github.com/arduino/Arduino/issues/4230","id":119406639,"number":4230,"title":"Parsing Mac OS X's `system_profiler` for USB information is a blunderbuss.","user":{"login":"mralexgray","id":262517,"avatar_url":"https://avatars.githubusercontent.com/u/262517?v=3","gravatar_id":"","url":"https://api.github.com/users/mralexgray","html_url":"https://github.com/mralexgray","followers_url":"https://api.github.com/users/mralexgray/followers","following_url":"https://api.github.com/users/mralexgray/following{/other_user}","gists_url":"https://api.github.com/users/mralexgray/gists{/gist_id}","starred_url":"https://api.github.com/users/mralexgray/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mralexgray/subscriptions","organizations_url":"https://api.github.com/users/mralexgray/orgs","repos_url":"https://api.github.com/users/mralexgray/repos","events_url":"https://api.github.com/users/mralexgray/events{/privacy}","received_events_url":"https://api.github.com/users/mralexgray/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-11-30T02:16:34Z","updated_at":"2015-11-30T07:53:05Z","closed_at":null,"body":"I constantly see `Arduino.app` spawning the process \r\n\r\n    -+= 00001 root /sbin/launchd\r\n     \\-+= 10895 me /.../Arduino.app/Contents/MacOS/Arduino\r\n       \\-+- 13588 me /usr/sbin/system_profiler SPUSBDataType\r\n         \\--= 13594 me /usr/sbin/system_profiler -nospawn -xml SPUSBDataType -detailLevel full\r\n\r\n\r\nThe `system_profiler` is notoriously slow, resource hungry, and certainly not the appropriate tool to query the USB subsystem's  capabilities.   It may be \"easy\" just to parse some XML that Apple graciously provides..  but that unfortunately does not make it prudent and/or sane to do so.\r\n\r\nI see the `java` code calling out to this <strike>API</strike> command-line tool  in `arduino-core/src/processing/app/macosx/Platform.java` ...\r\n\r\n```java\r\n    try {\r\n      CommandLine toDevicePath = CommandLine.parse(\"/usr/sbin/system_profiler SPUSBDataType\");\r\n      executor.execute(toDevicePath);\r\n      return new String(baos.toByteArray());\r\n    } catch (Throwable e) {\r\n      return super.preListAllCandidateDevices();\r\n    }\r\n```\r\nI confess to have _never even glanced_ at a piece of Java software before - nor do I hope to start now.. but I'd _imagine_ that there are plenty of (more) native bridges - between the Cocoa/ObjC subsystem and Java (or at least some way to access the hardware that isn't as brutal and archaic as parsing the output of a utility designed for only the most occasional of system inquiries).\r\n\r\nPlease let me know if this kind of integration is outside of your team's comfort zone, and I'm sure myself or some other issue onlooker can help.  I definitely think this constant polling is affecting `Arduino.app`'s performance, as well as needlessly burdening the host system as a result.  I would guess offhand that `IOKit` and/or `SystemConfiguration` frameworks would be a good place to start to find an alternative method to obtain the information you need re: the serial ports / whatnot.  If not, there are great alternatives such as [ORSerialPort](https://github.com/armadsen/ORSSerialPort) that may also be of some service in this endeavor."},"comment":{"url":"https://api.github.com/repos/arduino/Arduino/issues/comments/160547004","html_url":"https://github.com/arduino/Arduino/issues/4230#issuecomment-160547004","issue_url":"https://api.github.com/repos/arduino/Arduino/issues/4230","id":160547004,"user":{"login":"ffissore","id":510465,"avatar_url":"https://avatars.githubusercontent.com/u/510465?v=3","gravatar_id":"","url":"https://api.github.com/users/ffissore","html_url":"https://github.com/ffissore","followers_url":"https://api.github.com/users/ffissore/followers","following_url":"https://api.github.com/users/ffissore/following{/other_user}","gists_url":"https://api.github.com/users/ffissore/gists{/gist_id}","starred_url":"https://api.github.com/users/ffissore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ffissore/subscriptions","organizations_url":"https://api.github.com/users/ffissore/orgs","repos_url":"https://api.github.com/users/ffissore/repos","events_url":"https://api.github.com/users/ffissore/events{/privacy}","received_events_url":"https://api.github.com/users/ffissore/received_events","type":"User","site_admin":false},"created_at":"2015-11-30T07:53:05Z","updated_at":"2015-11-30T07:53:05Z","body":"Uhm so our current implementation is notoriously slow, resource hungry, \nbrutal and archaic. Wow.\n\nAlex Gray ha scritto il 30/11/2015 alle 03:16:\n> ...but I'd /imagine/ that there are plenty of (more) native bridges...\n\nPlease let us know if you come up with an implementable solution, which \nis faster than the current one. ORSSerialPort is an ObjC library, which \nmeans we could use it only if you could code a JNI wrapper around it, or \nif you can make a command line version (they have a CLI demo, but it's \ninteractive, so it won't work)\n\nLooking forward for your proposals\n"}}