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
This commit is contained in:
Maksim Yevmenkin 2005-05-18 23:03:44 +00:00
parent 6a52a06851
commit c46a9ea89b
2 changed files with 4 additions and 3 deletions

View File

@ -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");

View File

@ -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));