Increase preset RTS/DTR command buffer size

This commit is contained in:
hedgecrw85 2019-10-29 11:37:51 -05:00
parent 11864b4afe
commit 0acc234660
5 changed files with 15 additions and 15 deletions

View File

@ -2,7 +2,7 @@
* SerialPort_Android.c * SerialPort_Android.c
* *
* Created on: Mar 13, 2015 * Created on: Mar 13, 2015
* Last Updated on: Oct 15, 2019 * Last Updated on: Oct 29, 2019
* Author: Will Hedgecock * Author: Will Hedgecock
* *
* Copyright (C) 2012-2019 Fazecast, Inc. * Copyright (C) 2012-2019 Fazecast, Inc.
@ -612,7 +612,7 @@ JNIEXPORT jboolean JNICALL Java_com_fazecast_jSerialComm_SerialPort_presetRTS(JN
const char *portName = (*env)->GetStringUTFChars(env, portNameJString, NULL); const char *portName = (*env)->GetStringUTFChars(env, portNameJString, NULL);
// Send a system command to preset the RTS mode of the serial port // Send a system command to preset the RTS mode of the serial port
char commandString[64]; char commandString[128];
sprintf(commandString, "stty -F %s hupcl >>/dev/null 2>&1", portName); sprintf(commandString, "stty -F %s hupcl >>/dev/null 2>&1", portName);
int result = system(commandString); int result = system(commandString);
@ -626,7 +626,7 @@ JNIEXPORT jboolean JNICALL Java_com_fazecast_jSerialComm_SerialPort_preclearRTS(
const char *portName = (*env)->GetStringUTFChars(env, portNameJString, NULL); const char *portName = (*env)->GetStringUTFChars(env, portNameJString, NULL);
// Send a system command to preset the RTS mode of the serial port // Send a system command to preset the RTS mode of the serial port
char commandString[64]; char commandString[128];
sprintf(commandString, "stty -F %s -hupcl >>/dev/null 2>&1", portName); sprintf(commandString, "stty -F %s -hupcl >>/dev/null 2>&1", portName);
int result = system(commandString); int result = system(commandString);
@ -656,7 +656,7 @@ JNIEXPORT jboolean JNICALL Java_com_fazecast_jSerialComm_SerialPort_presetDTR(JN
const char *portName = (*env)->GetStringUTFChars(env, portNameJString, NULL); const char *portName = (*env)->GetStringUTFChars(env, portNameJString, NULL);
// Send a system command to preset the DTR mode of the serial port // Send a system command to preset the DTR mode of the serial port
char commandString[64]; char commandString[128];
sprintf(commandString, "stty -F %s hupcl >>/dev/null 2>&1", portName); sprintf(commandString, "stty -F %s hupcl >>/dev/null 2>&1", portName);
int result = system(commandString); int result = system(commandString);
@ -670,7 +670,7 @@ JNIEXPORT jboolean JNICALL Java_com_fazecast_jSerialComm_SerialPort_preclearDTR(
const char *portName = (*env)->GetStringUTFChars(env, portNameJString, NULL); const char *portName = (*env)->GetStringUTFChars(env, portNameJString, NULL);
// Send a system command to preset the DTR mode of the serial port // Send a system command to preset the DTR mode of the serial port
char commandString[64]; char commandString[128];
sprintf(commandString, "stty -F %s -hupcl >>/dev/null 2>&1", portName); sprintf(commandString, "stty -F %s -hupcl >>/dev/null 2>&1", portName);
int result = system(commandString); int result = system(commandString);

View File

@ -2,7 +2,7 @@
* SerialPort_Posix.c * SerialPort_Posix.c
* *
* Created on: Feb 25, 2012 * Created on: Feb 25, 2012
* Last Updated on: Oct 15, 2019 * Last Updated on: Oct 29, 2019
* Author: Will Hedgecock * Author: Will Hedgecock
* *
* Copyright (C) 2012-2019 Fazecast, Inc. * Copyright (C) 2012-2019 Fazecast, Inc.
@ -722,7 +722,7 @@ JNIEXPORT jboolean JNICALL Java_com_fazecast_jSerialComm_SerialPort_presetRTS(JN
const char *portName = (*env)->GetStringUTFChars(env, portNameJString, NULL); const char *portName = (*env)->GetStringUTFChars(env, portNameJString, NULL);
// Send a system command to preset the RTS mode of the serial port // Send a system command to preset the RTS mode of the serial port
char commandString[64]; char commandString[128];
#if defined(__linux__) #if defined(__linux__)
sprintf(commandString, "stty -F %s hupcl >>/dev/null 2>&1", portName); sprintf(commandString, "stty -F %s hupcl >>/dev/null 2>&1", portName);
#else #else
@ -740,7 +740,7 @@ JNIEXPORT jboolean JNICALL Java_com_fazecast_jSerialComm_SerialPort_preclearRTS(
const char *portName = (*env)->GetStringUTFChars(env, portNameJString, NULL); const char *portName = (*env)->GetStringUTFChars(env, portNameJString, NULL);
// Send a system command to preset the RTS mode of the serial port // Send a system command to preset the RTS mode of the serial port
char commandString[64]; char commandString[128];
#if defined(__linux__) #if defined(__linux__)
sprintf(commandString, "stty -F %s -hupcl >>/dev/null 2>&1", portName); sprintf(commandString, "stty -F %s -hupcl >>/dev/null 2>&1", portName);
#else #else
@ -774,7 +774,7 @@ JNIEXPORT jboolean JNICALL Java_com_fazecast_jSerialComm_SerialPort_presetDTR(JN
const char *portName = (*env)->GetStringUTFChars(env, portNameJString, NULL); const char *portName = (*env)->GetStringUTFChars(env, portNameJString, NULL);
// Send a system command to preset the DTR mode of the serial port // Send a system command to preset the DTR mode of the serial port
char commandString[64]; char commandString[128];
#if defined(__linux__) #if defined(__linux__)
sprintf(commandString, "stty -F %s hupcl >>/dev/null 2>&1", portName); sprintf(commandString, "stty -F %s hupcl >>/dev/null 2>&1", portName);
#else #else
@ -792,7 +792,7 @@ JNIEXPORT jboolean JNICALL Java_com_fazecast_jSerialComm_SerialPort_preclearDTR(
const char *portName = (*env)->GetStringUTFChars(env, portNameJString, NULL); const char *portName = (*env)->GetStringUTFChars(env, portNameJString, NULL);
// Send a system command to preset the DTR mode of the serial port // Send a system command to preset the DTR mode of the serial port
char commandString[64]; char commandString[128];
#if defined(__linux__) #if defined(__linux__)
sprintf(commandString, "stty -F %s -hupcl >>/dev/null 2>&1", portName); sprintf(commandString, "stty -F %s -hupcl >>/dev/null 2>&1", portName);
#else #else

View File

@ -2,7 +2,7 @@
* SerialPort_Windows.c * SerialPort_Windows.c
* *
* Created on: Feb 25, 2012 * Created on: Feb 25, 2012
* Last Updated on: Oct 15, 2019 * Last Updated on: Oct 29, 2019
* Author: Will Hedgecock * Author: Will Hedgecock
* *
* Copyright (C) 2012-2019 Fazecast, Inc. * Copyright (C) 2012-2019 Fazecast, Inc.
@ -803,7 +803,7 @@ JNIEXPORT jboolean JNICALL Java_com_fazecast_jSerialComm_SerialPort_presetRTS(JN
int result = -1; int result = -1;
if (comPort != NULL) if (comPort != NULL)
{ {
char commandString[32]; char commandString[64];
sprintf(commandString, "cmd.exe /C \"MODE %s rts=on > nul 2>&1\"", comPort + 1); sprintf(commandString, "cmd.exe /C \"MODE %s rts=on > nul 2>&1\"", comPort + 1);
result = system(commandString); result = system(commandString);
} }
@ -822,7 +822,7 @@ JNIEXPORT jboolean JNICALL Java_com_fazecast_jSerialComm_SerialPort_preclearRTS(
int result = -1; int result = -1;
if (comPort != NULL) if (comPort != NULL)
{ {
char commandString[32]; char commandString[64];
sprintf(commandString, "cmd.exe /C \"MODE %s rts=off > nul 2>&1\"", comPort + 1); sprintf(commandString, "cmd.exe /C \"MODE %s rts=off > nul 2>&1\"", comPort + 1);
result = system(commandString); result = system(commandString);
} }
@ -857,7 +857,7 @@ JNIEXPORT jboolean JNICALL Java_com_fazecast_jSerialComm_SerialPort_presetDTR(JN
int result = -1; int result = -1;
if (comPort != NULL) if (comPort != NULL)
{ {
char commandString[32]; char commandString[64];
sprintf(commandString, "cmd.exe /C \"MODE %s dtr=on > nul 2>&1\"", comPort + 1); sprintf(commandString, "cmd.exe /C \"MODE %s dtr=on > nul 2>&1\"", comPort + 1);
result = system(commandString); result = system(commandString);
} }
@ -876,7 +876,7 @@ JNIEXPORT jboolean JNICALL Java_com_fazecast_jSerialComm_SerialPort_preclearDTR(
int result = -1; int result = -1;
if (comPort != NULL) if (comPort != NULL)
{ {
char commandString[32]; char commandString[64];
sprintf(commandString, "cmd.exe /C \"MODE %s dtr=off > nul 2>&1\"", comPort + 1); sprintf(commandString, "cmd.exe /C \"MODE %s dtr=off > nul 2>&1\"", comPort + 1);
result = system(commandString); result = system(commandString);
} }