Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
<execution>
<id>default-compile</id>
<configuration>
<release>6</release>
<release>8</release>
<debug>false</debug>
<excludes>
<exclude>module-info.java</exclude>
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/com/fazecast/jSerialComm/SerialPort.java
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,8 @@ public final boolean openPort(int safetySleepTime, int deviceSendQueueSize, int
try { Thread.sleep(safetySleepTimeMS); } catch (Exception e) { Thread.currentThread().interrupt(); }

// If this is an Android root application, we must explicitly allow serial port access to the library
File portFile = isAndroidDelete ? new File(comPort) : null;
// Skip su/chmod when androidPort is already set (USB serial path handles open itself)
File portFile = (isAndroidDelete && androidPort == null) ? new File(comPort) : null;
if (portFile != null && (!portFile.canRead() || !portFile.canWrite()))
{
Process process = null;
Expand Down Expand Up @@ -1130,6 +1131,10 @@ public final boolean setDTRandRTS(boolean dtr, boolean rts)

// SerialPort Constructors
private SerialPort() {}
private SerialPort(String port, String friendly, String description, String location, String serial, String manufacture, int vid, int pid)
{
this(port, friendly, description, location, serial, manufacture, "", vid, pid);
}
private SerialPort(String port, String friendly, String description, String location, String serial, String manufacture, String driver, int vid, int pid)
{
comPort = port;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,15 +147,17 @@ public static SerialPort[] getCommPortsNative()
AndroidPort androidPort = null;

Constructor<SerialPort> serialPortConstructor =
SerialPort.class.getDeclaredConstructor(String.class, String.class, String.class, String.class, String.class, int.class, int.class);
SerialPort.class.getDeclaredConstructor(String.class, String.class, String.class, String.class, String.class, String.class, String.class, int.class, int.class);
serialPortConstructor.setAccessible(true);

SerialPort serialPort = serialPortConstructor.newInstance(
"COM" + (ports.size() + 1),
device.getDeviceName(),
device.getProductName(),
device.getProductName(),
device.getDeviceName(),
device.getSerialNumber(),
device.getSerialNumber(),
device.getManufacturerName(),
"",
device.getVendorId(),
device.getProductId()
);
Expand Down