I’ve spent some time playing with sixad (Gasia branch). I’ve found that hid_server() function (see bluetooth.cpp) loops continously and exits each and every cycle after getting zero or negative value from ppoll() (see code below). Pressing Home button while disconnected from USB does not affect behavior. Here I’m stuck since I do not really understand what ppoll() expected to return…
while (!io_canceled()) {
int i, idx = 2;
for (i=0; i<idx; i++)
p[i].revents = 0;
timeout.tv_sec = 1;
timeout.tv_nsec = 0;
if (ppoll(p, idx, &timeout, &sigs) < 1)
continue;
events = p[0].revents | p[1].revents;
if (events & POLLIN) {
if (debug) syslog(LOG_INFO, "One event received");
l2cap_accept(ctl, csk, isk, debug, legacy);
if (debug) syslog(LOG_INFO, "One event proccessed");
break;
}
if (events & (POLLERR | POLLHUP)) {
if (debug) syslog(LOG_ERR, "Server mode loop was broken");
break;
}
}