mirror of
https://github.com/SlimeVR/SlimeVR-Server.git
synced 2026-04-06 02:01:58 +02:00
Limit Android serial buffer to 1024 chars
This commit is contained in:
@@ -48,7 +48,7 @@ class AndroidSerialHandler(val activity: AppCompatActivity) :
|
||||
private val manager = activity.getSystemService(Context.USB_SERVICE) as UsbManager
|
||||
private var currentPort: SerialPortWrapper? = null
|
||||
private var requestingPermission: String = ""
|
||||
private var readBuffer: StringBuilder = StringBuilder(4096)
|
||||
private var readBuffer: StringBuilder = StringBuilder(1024)
|
||||
|
||||
override val isConnected: Boolean
|
||||
get() = currentPort?.port?.isOpen ?: false
|
||||
@@ -295,7 +295,7 @@ class AndroidSerialHandler(val activity: AppCompatActivity) :
|
||||
// than on desktop, so we don't read full lines and it causes parsing issues
|
||||
readBuffer.append(StandardCharsets.UTF_8.decode(ByteBuffer.wrap(data)))
|
||||
|
||||
if (readBuffer.contains('\n') || readBuffer.length >= 4096) {
|
||||
if (readBuffer.contains('\n') || readBuffer.length >= 1024) {
|
||||
addLog(readBuffer.toString(), false)
|
||||
readBuffer.clear()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user