diff options
author | Maksim Yevmenkin <emax@FreeBSD.org> | 2005-05-18 23:03:44 +0000 |
---|---|---|
committer | Maksim Yevmenkin <emax@FreeBSD.org> | 2005-05-18 23:03:44 +0000 |
commit | c46a9ea89b8b28ea182f332af1025907d2283df1 (patch) | |
tree | 25c23080b909f8fc43f1524be39267d3ea21da51 /usr.sbin/bluetooth | |
parent | 6a52a0685124ce584cf404fd8733dd0f8ff1c222 (diff) | |
download | src-c46a9ea89b8b28ea182f332af1025907d2283df1.tar.gz src-c46a9ea89b8b28ea182f332af1025907d2283df1.zip |
Fix problem with session termination. bthidd(8) maintains two L2CAP
connections to Bluetooth HID device. As soon as Bluetooth HID device
is powered off (or goes out of RF range) the stack will terminate both
connections. File descriptors for both connections will become active
on next select(2) call. Because bthidd(8) processes file descriptors
in order, it will detect descriptor for one of the closed connections
first and kill the session. However, there is still a second (active)
descriptor that used to point to the same session. bthidd(8) used to
assert() if it cant find session by file descriptor, which was wrong.
While I'm here fix a couple of typos in parser.y
Reported by: Eric Anderson anderson AT centtech DOT com
MFC after: 3 days
Notes
Notes:
svn path=/head/; revision=146357
Diffstat (limited to 'usr.sbin/bluetooth')
-rw-r--r-- | usr.sbin/bluetooth/bthidd/parser.y | 4 | ||||
-rw-r--r-- | usr.sbin/bluetooth/bthidd/server.c | 3 |
2 files changed, 4 insertions, 3 deletions
diff --git a/usr.sbin/bluetooth/bthidd/parser.y b/usr.sbin/bluetooth/bthidd/parser.y index 7a95d26a528d..eda82f649652 100644 --- a/usr.sbin/bluetooth/bthidd/parser.y +++ b/usr.sbin/bluetooth/bthidd/parser.y @@ -315,12 +315,12 @@ print_hid_device(hid_device_p hid_device, FILE *f) for (i = 0; i < desc->size; i ++) { if ((i % 8) == 0) - fprintf(stdout, "\n "); + fprintf(f, "\n "); fprintf(f, "0x%2.2x ", desc->data[i]); } - fprintf(stdout, + fprintf(f, "\n" \ " };\n" \ "}\n"); diff --git a/usr.sbin/bluetooth/bthidd/server.c b/usr.sbin/bluetooth/bthidd/server.c index e2f716e22170..ad2c82835f43 100644 --- a/usr.sbin/bluetooth/bthidd/server.c +++ b/usr.sbin/bluetooth/bthidd/server.c @@ -332,7 +332,8 @@ server_process(bthid_server_p srv, int fd) char data[1024]; int len; - assert(s != NULL); + if (s == NULL) + return (0); /* can happen on device disconnect */ do { len = read(fd, data, sizeof(data)); |