* [RFC] l2test: add flushable cmd line options
@ 2011-01-27 13:39 Emeltchenko Andrei
0 siblings, 0 replies; only message in thread
From: Emeltchenko Andrei @ 2011-01-27 13:39 UTC (permalink / raw)
To: linux-bluetooth
From: Andrei Emeltchenko <andrei.emeltchenko@nokia.com>
---
test/l2test.c | 23 ++++++++++++++++++++++-
1 files changed, 22 insertions(+), 1 deletions(-)
diff --git a/test/l2test.c b/test/l2test.c
index 17883a9..ed19679 100644
--- a/test/l2test.c
+++ b/test/l2test.c
@@ -90,6 +90,9 @@ static bdaddr_t bdaddr;
static unsigned short psm = 10;
static unsigned short cid = 0;
+/* Flushable packet mode */
+static int unsigned flushable = 2;
+
/* Default number of frames to send (-1 = infinite) */
static int num_frames = -1;
@@ -301,6 +304,19 @@ static int do_connect(char *svr)
goto error;
}
+ /* Set flushable mode, when mode is incorrect pass through,
+ shall we handle bugs? */
+ if (flushable < 2) {
+ opt = flushable;
+ if (setsockopt(sk, SOL_BLUETOOTH, BT_FLUSHABLE,
+ &opt, sizeof(opt)) < 0) {
+ syslog(LOG_ERR, "Can't %s flushable mode: %s (%d)",
+ flushable? "set" : "reset",
+ strerror(errno), errno);
+ goto error;
+ }
+ }
+
/* Get current options */
memset(&opts, 0, sizeof(opts));
optlen = sizeof(opts);
@@ -1087,6 +1103,7 @@ static void usage(void)
"\t[-F fcs] use CRC16 check (default = 1)\n"
"\t[-Q num] Max Transmit value (default = 3)\n"
"\t[-Z size] Transmission Window size (default = 63)\n"
+ "\t[-f mode] Flushable mode\n"
"\t[-R] reliable mode\n"
"\t[-G] use connectionless channel (datagram)\n"
"\t[-U] use sock stream\n"
@@ -1104,7 +1121,7 @@ int main(int argc, char *argv[])
bacpy(&bdaddr, BDADDR_ANY);
- while ((opt=getopt(argc,argv,"rdscuwmntqxyzpb:i:P:I:O:J:B:N:L:W:C:D:X:F:Q:Z:RUGAESMT")) != EOF) {
+ while ((opt=getopt(argc,argv,"rdscuwmntqxyzpb:i:P:I:O:J:B:N:L:W:C:D:X:F:Q:Z:f:RUGAESMT")) != EOF) {
switch(opt) {
case 'r':
mode = RECV;
@@ -1268,6 +1285,10 @@ int main(int argc, char *argv[])
txwin_size = atoi(optarg);
break;
+ case 'f':
+ flushable = atoi(optarg);
+ break;
+
case 'J':
cid = atoi(optarg);
break;
--
1.7.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2011-01-27 13:39 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-27 13:39 [RFC] l2test: add flushable cmd line options Emeltchenko Andrei
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox