{"action":"opened","issue":{"url":"https://api.github.com/repos/PDXostc/rvi_mobile_unlock/issues/4","labels_url":"https://api.github.com/repos/PDXostc/rvi_mobile_unlock/issues/4/labels{/name}","comments_url":"https://api.github.com/repos/PDXostc/rvi_mobile_unlock/issues/4/comments","events_url":"https://api.github.com/repos/PDXostc/rvi_mobile_unlock/issues/4/events","html_url":"https://github.com/PDXostc/rvi_mobile_unlock/issues/4","id":105646907,"number":4,"title":"BT Connectivity - RasPi BT connection failure mode - repeatedly resets","user":{"login":"dvthiriezP3","id":13394675,"avatar_url":"https://avatars.githubusercontent.com/u/13394675?v=3","gravatar_id":"","url":"https://api.github.com/users/dvthiriezP3","html_url":"https://github.com/dvthiriezP3","followers_url":"https://api.github.com/users/dvthiriezP3/followers","following_url":"https://api.github.com/users/dvthiriezP3/following{/other_user}","gists_url":"https://api.github.com/users/dvthiriezP3/gists{/gist_id}","starred_url":"https://api.github.com/users/dvthiriezP3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dvthiriezP3/subscriptions","organizations_url":"https://api.github.com/users/dvthiriezP3/orgs","repos_url":"https://api.github.com/users/dvthiriezP3/repos","events_url":"https://api.github.com/users/dvthiriezP3/events{/privacy}","received_events_url":"https://api.github.com/users/dvthiriezP3/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-09-09T17:35:13Z","updated_at":"2015-09-09T17:35:13Z","closed_at":null,"body":"I’m now consistently encountering a failure that appears to be BT connectivity resetting itself periodically every ~1-2 seconds on the RasPi.\r\nGenerally, this occurs after the RasPi has been running a while.\r\nE.g. RVI and BT boot up fine and are able to accept RVI commands without issue, but after ~5 minutes of uptime, the issue starts.\r\n \r\nIssue manifests itself with the following error message on the RasPi (rvi_core console) and mobile app (LogCat)… see logs below.\r\nI'm thinking this might be a hardware issue with the BT dongle or how I have it configured? Setup is using a Kensington Bluetooth 4.0 USB Adapter P/N K33956AM.\r\n \r\n\r\n**Mobile app shows BT socket closed**\r\nService disappeared showing up on rvi_core logs when attempting a service.\r\nBecause of this, no services get through to the RasPi's Python script.\r\n```java\r\n09-06 23:20:21.623  26275-28964/com.jaguarlandrover.auto.remote.vehicleentry W/BluetoothAdapter﹕ getBluetoothService() called with no BluetoothManagerCallback\r\n09-06 23:19:41.372  26275-28179/com.jaguarlandrover.auto.remote.vehicleentry D/RVI﹕ Excepption:read failed, socket might closed or timeout, read ret: -1\r\n09-06 23:19:41.372  26275-28179/com.jaguarlandrover.auto.remote.vehicleentry W/BluetoothAdapter﹕ getBluetoothService() called with no BluetoothManagerCallback\r\n09-06 23:19:46.501  26275-28179/com.jaguarlandrover.auto.remote.vehicleentry W/System.err﹕ java.io.IOException: read failed, socket might closed or timeout, read ret: -1\r\n09-06 23:19:46.502  26275-28179/com.jaguarlandrover.auto.remote.vehicleentry W/System.err﹕ at android.bluetooth.BluetoothSocket.readAll(BluetoothSocket.java:512)\r\n09-06 23:19:46.502  26275-28179/com.jaguarlandrover.auto.remote.vehicleentry W/System.err﹕ at android.bluetooth.BluetoothSocket.waitSocketSignal(BluetoothSocket.java:489)\r\n09-06 23:19:46.502  26275-28179/com.jaguarlandrover.auto.remote.vehicleentry W/System.err﹕ at android.bluetooth.BluetoothSocket.connect(BluetoothSocket.java:319)\r\n09-06 23:19:46.502  26275-28179/com.jaguarlandrover.auto.remote.vehicleentry W/System.err﹕ at com.jaguarlandrover.auto.remote.vehicleentry.RviService$4.call(RviService.java:614)\r\n09-06 23:19:46.503  26275-28179/com.jaguarlandrover.auto.remote.vehicleentry W/System.err﹕ at com.jaguarlandrover.auto.remote.vehicleentry.RviService$4.call(RviService.java:584)\r\n09-06 23:19:46.515  26275-28179/com.jaguarlandrover.auto.remote.vehicleentry W/System.err﹕ at rx.Observable.unsafeSubscribe(Observable.java:7304)\r\n09-06 23:19:46.515  26275-28179/com.jaguarlandrover.auto.remote.vehicleentry W/System.err﹕ at rx.internal.operators.OperatorSubscribeOn$1$1.call(OperatorSubscribeOn.java:62)\r\n09-06 23:19:46.515  26275-28179/com.jaguarlandrover.auto.remote.vehicleentry W/System.err﹕ at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:47)\r\n09-06 23:19:46.515  26275-28179/com.jaguarlandrover.auto.remote.vehicleentry W/System.err﹕ at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)\r\n09-06 23:19:46.515  26275-28179/com.jaguarlandrover.auto.remote.vehicleentry W/System.err﹕ at java.util.concurrent.FutureTask.run(FutureTask.java:237)\r\n09-06 23:19:46.516  26275-28179/com.jaguarlandrover.auto.remote.vehicleentry W/System.err﹕ at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:152)\r\n09-06 23:19:46.516  26275-28179/com.jaguarlandrover.auto.remote.vehicleentry W/System.err﹕ at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:265)\r\n09-06 23:19:46.516  26275-28179/com.jaguarlandrover.auto.remote.vehicleentry W/System.err﹕ at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)\r\n09-06 23:19:46.516  26275-28179/com.jaguarlandrover.auto.remote.vehicleentry W/System.err﹕ at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)\r\n09-06 23:19:46.516  26275-28179/com.jaguarlandrover.auto.remote.vehicleentry W/System.err﹕ at java.lang.Thread.run(Thread.java:818)\r\n09-06 23:19:46.517  26275-28179/com.jaguarlandrover.auto.remote.vehicleentry I/RVI﹕ Sending to socket authandroid.bluetooth.BluetoothSocket@21715ba4\r\n09-06 23:19:46.518  26275-28179/com.jaguarlandrover.auto.remote.vehicleentry E/RVI﹕ Resetting .....\r\n09-06 23:19:46.540  26275-26430/com.jaguarlandrover.auto.remote.vehicleentry E/RVI﹕ java.io.IOException: Broken pipe\r\n            at android.net.LocalSocketImpl.writeba_native(Native Method)\r\n            at android.net.LocalSocketImpl.access$600(LocalSocketImpl.java:33)\r\n            at android.net.LocalSocketImpl$SocketOutputStream.write(LocalSocketImpl.java:135)\r\n            at android.bluetooth.BluetoothSocket.write(BluetoothSocket.java:442)\r\n            at android.bluetooth.BluetoothOutputStream.write(BluetoothOutputStream.java:85)\r\n            at java.io.OutputStream.write(OutputStream.java:82)\r\n            at com.jaguarlandrover.auto.remote.vehicleentry.RviService$4.call(RviService.java:633)\r\n            at com.jaguarlandrover.auto.remote.vehicleentry.RviService$4.call(RviService.java:584)\r\n            at rx.Observable.unsafeSubscribe(Observable.java:7304)\r\n            at rx.internal.operators.OperatorSubscribeOn$1$1.call(OperatorSubscribeOn.java:62)\r\n            at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:47)\r\n            at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)\r\n            at java.util.concurrent.FutureTask.run(FutureTask.java:237)\r\n            at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:152)\r\n            at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:265)\r\n            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)\r\n            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)\r\n            at java.lang.Thread.run(Thread.java:818)\r\n```\r\n\r\n\r\n**rvi_core console shows bt/stoffe/{service name} as disappeared**\r\n```erlang\r\n(rvi@127.0.0.1)1> \r\n(rvi@127.0.0.1)1> c_src/bt_linux_drv.c:388: rfcomm_running: 5 has input\r\nc_src/bt_linux_drv.c:389: rfcomm_running: sub 0x1bab730\r\nc_src/bt_linux_drv.c:390: rfcomm_running: id 23\r\n00:51:55.653 [debug] bt_connection:handle_info(data): Data: <<\"{\"tid\":2,\"cmd\":\"rcv\",\"mod\":\"proto_json_rpc\",\"data\":\"eyJzZXJ2aWNlIjoiamxyLmNvbVwvYnRcL3N0b2ZmZVwvdW5sb2NrIiwidGltZW91dCI6MTQzMzI2\\nNjcwNCwicGFyYW1ldGVycyI6W3sidXNlcm5hbWUiOiIwIiwidmVoaWNsZVZJTiI6IjAiLCJsYXRp\\ndHVkZSI6MzMuODM5MjIyMDksImxvbmdpdHVkZSI6LTExNy45MjM2MjIwOX1dLCJjZXJ0aWZpY2F0\\nZSI6IiIsInNpZ25hdHVyZSI6IiJ9\\n\"}\">>\r\n00:51:55.655 [info] bt_connection:handle_info(data): From: {12,72,133,32,86,25}:1 \r\n00:51:55.656 [info] bt_connection:handle_info(data): {12,72,133,32,86,25}:1 -> dlink_bt_rpc:handle_socket\r\n00:51:55.657 [debug] dlink_bt:data(): Got [{\"tid\",2},{\"cmd\",\"rcv\"},{\"mod\",\"proto_json_rpc\"},{\"data\",\"eyJzZXJ2aWNlIjoiamxyLmNvbVwvYnRcL3N0b2ZmZVwvdW5sb2NrIiwidGltZW91dCI6MTQzMzI2\\nNjcwNCwicGFyYW1ldGVycyI6W3sidXNlcm5hbWUiOiIwIiwidmVoaWNsZVZJTiI6IjAiLCJsYXRp\\ndHVkZSI6MzMuODM5MjIyMDksImxvbmdpdHVkZSI6LTExNy45MjM2MjIwOX1dLCJjZXJ0aWZpY2F0\\nZSI6IiIsInNpZ25hdHVyZSI6IiJ9\\n\"}]\r\n00:51:55.659 [debug] dlink_bt:receive_data(): SetupAddress: {{12,72,133,32,86,25}, 1}\r\n00:51:55.659 [debug] dlink_bt:receive_data(): \"proto_json_rpc\":receive_message(\"eyJzZXJ2aWNlIjoiamxyLmNvbVwvYnRcL3N0b2ZmZVwvdW5sb2NrIiwidGltZW91dCI6MTQzMzI2\\nNjcwNCwicGFyYW1ldGVycyI6W3sidXNlcm5hbWUiOiIwIiwidmVoaWNsZVZJTiI6IjAiLCJsYXRp\\ndHVkZSI6MzMuODM5MjIyMDksImxvbmdpdHVkZSI6LTExNy45MjM2MjIwOX1dLCJjZXJ0aWZpY2F0\\nZSI6IiIsInNpZ25hdHVyZSI6IiJ9\\n\")\r\n00:51:55.661 [debug] Sending protocol - proto_json_rpc:receive_message([\"{\"service\":\"jlr.com\\/bt\\/stoffe\\/unlock\",\"timeout\":1433266704,\"parameters\":[{\"username\":\"0\",\"vehicleVIN\":\"0\",\"latitude\":33.83922209,\"longitude\":-117.92362209}],\"certificate\":\"\",\"signature\":\"\"}\"])\r\n00:51:55.663 [debug]     protocol:rcv(): service name:    \"jlr.com/bt/stoffe/unlock\"\r\n00:51:55.664 [debug]     protocol:rcv(): timeout:         1433266704\r\n00:51:55.665 [debug]     protocol:rcv(): signature:       []\r\n00:51:55.665 [debug]     protocol:rcv(): certificate:     []\r\n00:51:55.666 [debug] Sending service_edge - service_edge_rpc:handle_remote_message([\"jlr.com/bt/stoffe/unlock\",1433266704,{array,[{struct,[{\"username\",\"0\"},{\"vehicleVIN\",\"0\"},{\"latitude\",33.83922209},{\"longitude\",-117.92362209}]}]},[],[]])\r\n00:51:55.667 [debug] service_edge:remote_msg(): service_name:    \"jlr.com/bt/stoffe/unlock\"\r\n00:51:55.668 [debug] service_edge:remote_msg(): timeout:         1433266704\r\n00:51:55.669 [debug] service_edge:remote_msg(): parameters:      {array,[{struct,[{\"username\",\"0\"},{\"vehicleVIN\",\"0\"},{\"latitude\",33.83922209},{\"longitude\",-117.92362209}]}]}\r\n00:51:55.670 [debug] service_edge:remote_msg(): signature:       []\r\n00:51:55.670 [debug] service_edge:remote_msg(): certificate:     []\r\n00:51:55.671 [notice] service_entry:remote_msg(): Service Disappeared \"jlr.com/bt/stoffe/unlock\"\r\n```\r\nThe closed/restarted BT connection might be the cause of RVI losing the service hosted on the mobile phone side."}}