summaryrefslogtreecommitdiffstats
path: root/usr.sbin/bluetooth
diff options
context:
space:
mode:
authoremax <emax@FreeBSD.org>2005-05-18 23:03:44 +0000
committeremax <emax@FreeBSD.org>2005-05-18 23:03:44 +0000
commit050a3f3809cde7809c26de3701de449faec287cb (patch)
tree25c23080b909f8fc43f1524be39267d3ea21da51 /usr.sbin/bluetooth
parent72bafed72fb51c19757071ca9427f514ca991ae5 (diff)
downloadFreeBSD-src-050a3f3809cde7809c26de3701de449faec287cb.zip
FreeBSD-src-050a3f3809cde7809c26de3701de449faec287cb.tar.gz
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
Diffstat (limited to 'usr.sbin/bluetooth')
-rw-r--r--usr.sbin/bluetooth/bthidd/parser.y4
-rw-r--r--usr.sbin/bluetooth/bthidd/server.c3
2 files changed, 4 insertions, 3 deletions
diff --git a/usr.sbin/bluetooth/bthidd/parser.y b/usr.sbin/bluetooth/bthidd/parser.y
index 7a95d26..eda82f6 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 e2f716e..ad2c828 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));
OpenPOWER on IntegriCloud