118 /* HCI timeouts */ 119 #define HCI_CONNECT_TIMEOUT (40000) /* 40 seconds */ 120 #define HCI_DISCONN_TIMEOUT (2000) /* 2 seconds */ 121 #define HCI_PAIRING_TIMEOUT (60000) /* 60 seconds */ 122 #define HCI_IDLE_TIMEOUT (6000) /* 6 seconds */ 123 #define HCI_INIT_TIMEOUT (10000) /* 10 seconds */ 124 #define HCI_CMD_TIMEOUT (1000) /* 1 seconds */
Actual disconnection happens in hci_conn_timeout(). Other issue is that such disconnect reported as "Remote User Terminated Connection", which is, well, not true, as I don't terminate it, the system does. There's another status code, "Remote Device Terminated Connection due to Low Resources" which IMHO more suitable (if there's no "low resources", why do you disconnect so quickly, dear Linux?).
I quickly made a patch to be able to adjust disconnect timeout via sysfs, to experiment with low level connection more comfortably. Unfortunately, it turns out that I can extend delay to max 10s, even if set value much higher. So, something appears to call disconnect routine, even though I don't see any other references or timer manipulation %).