mirror of
https://github.com/esp8266/Arduino.git
synced 2025-08-09 22:24:14 +03:00
21 lines
523 B
Java
21 lines
523 B
Java
package processing.app.linux;
|
|
|
|
import java.io.IOException;
|
|
import java.io.StringReader;
|
|
import java.util.Properties;
|
|
|
|
public class UDevAdmParser {
|
|
|
|
public String extractVIDAndPID(String output) throws IOException {
|
|
Properties properties = new Properties();
|
|
properties.load(new StringReader(output));
|
|
|
|
Object vid = properties.get("ID_VENDOR_ID");
|
|
Object pid = properties.get("ID_MODEL_ID");
|
|
if (vid == null || pid == null)
|
|
return null;
|
|
return ("0x" + vid + "_0x" + pid).toUpperCase();
|
|
}
|
|
|
|
}
|