mysterious code (qtserialbleutooth.cpp)

Jan Mulder jlmulder at xs4all.nl
Tue Jul 18 06:49:24 PDT 2017


Struggling with BLE for OSTC I see a little mysterious code fragment:

#define BUFSZ 1024
static struct {
	unsigned int out_bytes, in_bytes, in_pos;
	unsigned char in[BUFSIZ];
	unsigned char out[BUFSIZ];
} buffer;

As it is from Linus, I do not dare to change it right away :-)

Is the typo in the #define intentional? And where is the actual value 
defined? I see that on Android it has a value 1024, and on Linux 8192 
(bytes), so some system include I assume.

That 1K value on Android causes my BLE for OSTC to fail as the parser 
wants to pull 1K blocks at the time, and obviously, the incoming packets 
from the OSTC are coming in 20 byte packets, so we run out of memory a 
some random point, depending when the libdc actually consumes the input 
buffer.

--jan


More information about the subsurface mailing list