{"action":"created","issue":{"url":"https://api.github.com/repos/currantlabs/ble/issues/17","repository_url":"https://api.github.com/repos/currantlabs/ble","labels_url":"https://api.github.com/repos/currantlabs/ble/issues/17/labels{/name}","comments_url":"https://api.github.com/repos/currantlabs/ble/issues/17/comments","events_url":"https://api.github.com/repos/currantlabs/ble/issues/17/events","html_url":"https://github.com/currantlabs/ble/issues/17","id":190976288,"number":17,"title":"Is it possible to \"free\" the physical Bluetooth interface so that it can be used by external commands?","user":{"login":"josephroberts","id":1107385,"avatar_url":"https://avatars.githubusercontent.com/u/1107385?v=3","gravatar_id":"","url":"https://api.github.com/users/josephroberts","html_url":"https://github.com/josephroberts","followers_url":"https://api.github.com/users/josephroberts/followers","following_url":"https://api.github.com/users/josephroberts/following{/other_user}","gists_url":"https://api.github.com/users/josephroberts/gists{/gist_id}","starred_url":"https://api.github.com/users/josephroberts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/josephroberts/subscriptions","organizations_url":"https://api.github.com/users/josephroberts/orgs","repos_url":"https://api.github.com/users/josephroberts/repos","events_url":"https://api.github.com/users/josephroberts/events{/privacy}","received_events_url":"https://api.github.com/users/josephroberts/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-11-22T11:36:33Z","updated_at":"2016-12-31T12:00:54Z","closed_at":null,"body":"I would like to be able to use the physical Bluetooth interface without stopping the go application so I need some way to free up the device once it has been initialised. Is this possible?\r\n\r\nWhile the code is running I get errors as expected:\r\n```\r\npackage main\r\n\r\nimport (\r\n\t\"flag\"\r\n\t\"fmt\"\r\n\t\"log\"\r\n\t\"time\"\r\n\r\n\t\"github.com/currantlabs/ble/examples/lib/dev\"\r\n)\r\n\r\nvar (\r\n\tdevice = flag.String(\"device\", \"default\", \"implementation of ble\")\r\n)\r\n\r\nfunc main() {\r\n\t_, err := dev.NewDevice(*device)\r\n\tif err != nil {\r\n\t\tlog.Fatalf(\"can't new device : %s\", err)\r\n\t}\r\n\tfmt.Println(\"opened\")\r\n\r\n\ttime.Sleep(100 * time.Second)\r\n}\r\n```\r\n```\r\n ~  gatttool -I -t random -b E0:1A:35:05:47:EB\r\n[E0:1A:35:05:47:EB][LE]> connect\r\nAttempting to connect to E0:1A:35:05:47:EB\r\nError: connect: No route to host (113)\r\n[E0:1A:35:05:47:EB][LE]> \r\n[E0:1A:35:05:47:EB][LE]> \r\n ~  sudo hciconfig hci0 reset\r\nCan't down device hci0: Device or resource busy (16)\r\n ✘  ~  sudo hciconfig hci0 down \r\nCan't down device hci0: Device or resource busy (16)\r\n ✘  ~  hciconfig dev\r\nhci0:    Type: Primary  Bus: USB\r\n    BD Address: E4:B3:18:4D:40:8F  ACL MTU: 1021:4  SCO MTU: 96:6\r\n    UP RUNNING \r\n    RX bytes:49338 acl:2 sco:0 events:3888 errors:0\r\n    TX bytes:625918 acl:181 sco:0 commands:4087 errors:0\r\n\r\n ~  gatttool -I -t random -b E0:1A:35:05:47:EB\r\n[E0:1A:35:05:47:EB][LE]> connect\r\nAttempting to connect to E0:1A:35:05:47:EB\r\nError: connect: No route to host (113)\r\n[E0:1A:35:05:47:EB][LE]> \r\n```\r\n\r\nIs it possible to free the device created and then use external commands during the sleep period?"},"comment":{"url":"https://api.github.com/repos/currantlabs/ble/issues/comments/269861999","html_url":"https://github.com/currantlabs/ble/issues/17#issuecomment-269861999","issue_url":"https://api.github.com/repos/currantlabs/ble/issues/17","id":269861999,"user":{"login":"deadprogram","id":5520,"avatar_url":"https://avatars.githubusercontent.com/u/5520?v=3","gravatar_id":"","url":"https://api.github.com/users/deadprogram","html_url":"https://github.com/deadprogram","followers_url":"https://api.github.com/users/deadprogram/followers","following_url":"https://api.github.com/users/deadprogram/following{/other_user}","gists_url":"https://api.github.com/users/deadprogram/gists{/gist_id}","starred_url":"https://api.github.com/users/deadprogram/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deadprogram/subscriptions","organizations_url":"https://api.github.com/users/deadprogram/orgs","repos_url":"https://api.github.com/users/deadprogram/repos","events_url":"https://api.github.com/users/deadprogram/events{/privacy}","received_events_url":"https://api.github.com/users/deadprogram/received_events","type":"User","site_admin":false},"created_at":"2016-12-31T12:00:54Z","updated_at":"2016-12-31T12:00:54Z","body":"Hi @josephroberts from a reading of the current code this is not currently possible, at least not in the manner you described. \r\n\r\nAt least on Linux, the `NewDevice()` function is opening the HCI and does not release it until `Stop()` is called, at which point you would need another `NewDevice()` call to reopen the connection."}}
{"actor":{"display_login":"deadprogram"}}