{"action":"created","comment":{"url":"https://api.github.com/repos/kylelemons/gousb/pulls/comments/101562373","pull_request_review_id":22295127,"id":101562373,"diff_hunk":"@@ -174,6 +174,11 @@ found:\n \t\t}\n \t}\n \n+\t// Detach the interface","path":"usb/device.go","position":4,"original_position":4,"commit_id":"a7f2e81ddffe8991d215a00b1d019227d7d778e1","original_commit_id":"a7f2e81ddffe8991d215a00b1d019227d7d778e1","user":{"login":"zagrodzki","id":12544080,"avatar_url":"https://avatars.githubusercontent.com/u/12544080?v=3","gravatar_id":"","url":"https://api.github.com/users/zagrodzki","html_url":"https://github.com/zagrodzki","followers_url":"https://api.github.com/users/zagrodzki/followers","following_url":"https://api.github.com/users/zagrodzki/following{/other_user}","gists_url":"https://api.github.com/users/zagrodzki/gists{/gist_id}","starred_url":"https://api.github.com/users/zagrodzki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zagrodzki/subscriptions","organizations_url":"https://api.github.com/users/zagrodzki/orgs","repos_url":"https://api.github.com/users/zagrodzki/repos","events_url":"https://api.github.com/users/zagrodzki/events{/privacy}","received_events_url":"https://api.github.com/users/zagrodzki/received_events","type":"User","site_admin":false},"body":"I would be concerned about re-attaching the driver later when you exit.\r\nReading through the libusb docs, I now see that there's a  libusb_set_auto_detach_kernel_driver function that will handle detach/reattach automatically. So maybe that would be a better way than managing the detach/reattach by hand?\r\n\r\nI would be fine in a boolean in the Device struct, e.g. something like \"AutoDetach bool\". It wouldn't be strictly concurrency safe, but I don't think it's an issue as long as it's set before you start opening endpoints.\r\n\r\nIt also would not be as flexible as detach/reattach by hand, as it will apply to all endpoints automatically. I think that's fine too.\r\n\r\nHow does that sound?","created_at":"2017-02-16T16:25:58Z","updated_at":"2017-02-16T16:29:46Z","html_url":"https://github.com/kylelemons/gousb/pull/32#discussion_r101562373","pull_request_url":"https://api.github.com/repos/kylelemons/gousb/pulls/32","_links":{"self":{"href":"https://api.github.com/repos/kylelemons/gousb/pulls/comments/101562373"},"html":{"href":"https://github.com/kylelemons/gousb/pull/32#discussion_r101562373"},"pull_request":{"href":"https://api.github.com/repos/kylelemons/gousb/pulls/32"}}},"pull_request":{"url":"https://api.github.com/repos/kylelemons/gousb/pulls/32","id":106552420,"html_url":"https://github.com/kylelemons/gousb/pull/32","diff_url":"https://github.com/kylelemons/gousb/pull/32.diff","patch_url":"https://github.com/kylelemons/gousb/pull/32.patch","issue_url":"https://api.github.com/repos/kylelemons/gousb/issues/32","number":32,"state":"open","locked":false,"title":"detach before claim","user":{"login":"vincentserpoul","id":1297404,"avatar_url":"https://avatars.githubusercontent.com/u/1297404?v=3","gravatar_id":"","url":"https://api.github.com/users/vincentserpoul","html_url":"https://github.com/vincentserpoul","followers_url":"https://api.github.com/users/vincentserpoul/followers","following_url":"https://api.github.com/users/vincentserpoul/following{/other_user}","gists_url":"https://api.github.com/users/vincentserpoul/gists{/gist_id}","starred_url":"https://api.github.com/users/vincentserpoul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vincentserpoul/subscriptions","organizations_url":"https://api.github.com/users/vincentserpoul/orgs","repos_url":"https://api.github.com/users/vincentserpoul/repos","events_url":"https://api.github.com/users/vincentserpoul/events{/privacy}","received_events_url":"https://api.github.com/users/vincentserpoul/received_events","type":"User","site_admin":false},"body":"Detach only on OpenEndpoint","created_at":"2017-02-16T15:45:02Z","updated_at":"2017-02-16T16:29:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2f72e2d3a080df7b1f4f7a7d3ad3a98f9d5fea71","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/kylelemons/gousb/pulls/32/commits","review_comments_url":"https://api.github.com/repos/kylelemons/gousb/pulls/32/comments","review_comment_url":"https://api.github.com/repos/kylelemons/gousb/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kylelemons/gousb/issues/32/comments","statuses_url":"https://api.github.com/repos/kylelemons/gousb/statuses/a7f2e81ddffe8991d215a00b1d019227d7d778e1","head":{"label":"vincentserpoul:master","ref":"master","sha":"a7f2e81ddffe8991d215a00b1d019227d7d778e1","user":{"login":"vincentserpoul","id":1297404,"avatar_url":"https://avatars.githubusercontent.com/u/1297404?v=3","gravatar_id":"","url":"https://api.github.com/users/vincentserpoul","html_url":"https://github.com/vincentserpoul","followers_url":"https://api.github.com/users/vincentserpoul/followers","following_url":"https://api.github.com/users/vincentserpoul/following{/other_user}","gists_url":"https://api.github.com/users/vincentserpoul/gists{/gist_id}","starred_url":"https://api.github.com/users/vincentserpoul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vincentserpoul/subscriptions","organizations_url":"https://api.github.com/users/vincentserpoul/orgs","repos_url":"https://api.github.com/users/vincentserpoul/repos","events_url":"https://api.github.com/users/vincentserpoul/events{/privacy}","received_events_url":"https://api.github.com/users/vincentserpoul/received_events","type":"User","site_admin":false},"repo":{"id":82195635,"name":"gousb","full_name":"vincentserpoul/gousb","owner":{"login":"vincentserpoul","id":1297404,"avatar_url":"https://avatars.githubusercontent.com/u/1297404?v=3","gravatar_id":"","url":"https://api.github.com/users/vincentserpoul","html_url":"https://github.com/vincentserpoul","followers_url":"https://api.github.com/users/vincentserpoul/followers","following_url":"https://api.github.com/users/vincentserpoul/following{/other_user}","gists_url":"https://api.github.com/users/vincentserpoul/gists{/gist_id}","starred_url":"https://api.github.com/users/vincentserpoul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vincentserpoul/subscriptions","organizations_url":"https://api.github.com/users/vincentserpoul/orgs","repos_url":"https://api.github.com/users/vincentserpoul/repos","events_url":"https://api.github.com/users/vincentserpoul/events{/privacy}","received_events_url":"https://api.github.com/users/vincentserpoul/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/vincentserpoul/gousb","description":"Idiomatic Go bindings for libusb-1.0","fork":true,"url":"https://api.github.com/repos/vincentserpoul/gousb","forks_url":"https://api.github.com/repos/vincentserpoul/gousb/forks","keys_url":"https://api.github.com/repos/vincentserpoul/gousb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vincentserpoul/gousb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vincentserpoul/gousb/teams","hooks_url":"https://api.github.com/repos/vincentserpoul/gousb/hooks","issue_events_url":"https://api.github.com/repos/vincentserpoul/gousb/issues/events{/number}","events_url":"https://api.github.com/repos/vincentserpoul/gousb/events","assignees_url":"https://api.github.com/repos/vincentserpoul/gousb/assignees{/user}","branches_url":"https://api.github.com/repos/vincentserpoul/gousb/branches{/branch}","tags_url":"https://api.github.com/repos/vincentserpoul/gousb/tags","blobs_url":"https://api.github.com/repos/vincentserpoul/gousb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vincentserpoul/gousb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vincentserpoul/gousb/git/refs{/sha}","trees_url":"https://api.github.com/repos/vincentserpoul/gousb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vincentserpoul/gousb/statuses/{sha}","languages_url":"https://api.github.com/repos/vincentserpoul/gousb/languages","stargazers_url":"https://api.github.com/repos/vincentserpoul/gousb/stargazers","contributors_url":"https://api.github.com/repos/vincentserpoul/gousb/contributors","subscribers_url":"https://api.github.com/repos/vincentserpoul/gousb/subscribers","subscription_url":"https://api.github.com/repos/vincentserpoul/gousb/subscription","commits_url":"https://api.github.com/repos/vincentserpoul/gousb/commits{/sha}","git_commits_url":"https://api.github.com/repos/vincentserpoul/gousb/git/commits{/sha}","comments_url":"https://api.github.com/repos/vincentserpoul/gousb/comments{/number}","issue_comment_url":"https://api.github.com/repos/vincentserpoul/gousb/issues/comments{/number}","contents_url":"https://api.github.com/repos/vincentserpoul/gousb/contents/{+path}","compare_url":"https://api.github.com/repos/vincentserpoul/gousb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vincentserpoul/gousb/merges","archive_url":"https://api.github.com/repos/vincentserpoul/gousb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vincentserpoul/gousb/downloads","issues_url":"https://api.github.com/repos/vincentserpoul/gousb/issues{/number}","pulls_url":"https://api.github.com/repos/vincentserpoul/gousb/pulls{/number}","milestones_url":"https://api.github.com/repos/vincentserpoul/gousb/milestones{/number}","notifications_url":"https://api.github.com/repos/vincentserpoul/gousb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vincentserpoul/gousb/labels{/name}","releases_url":"https://api.github.com/repos/vincentserpoul/gousb/releases{/id}","deployments_url":"https://api.github.com/repos/vincentserpoul/gousb/deployments","created_at":"2017-02-16T15:32:40Z","updated_at":"2017-02-16T15:32:42Z","pushed_at":"2017-02-16T15:42:04Z","git_url":"git://github.com/vincentserpoul/gousb.git","ssh_url":"git@github.com:vincentserpoul/gousb.git","clone_url":"https://github.com/vincentserpoul/gousb.git","svn_url":"https://github.com/vincentserpoul/gousb","homepage":"http://gopkgdoc.appspot.com/pkg/github.com/kylelemons/gousb/usb","size":3240,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"kylelemons:master","ref":"master","sha":"09150fc318605ff4b620cd83f6a52393f19bd880","user":{"login":"kylelemons","id":322213,"avatar_url":"https://avatars.githubusercontent.com/u/322213?v=3","gravatar_id":"","url":"https://api.github.com/users/kylelemons","html_url":"https://github.com/kylelemons","followers_url":"https://api.github.com/users/kylelemons/followers","following_url":"https://api.github.com/users/kylelemons/following{/other_user}","gists_url":"https://api.github.com/users/kylelemons/gists{/gist_id}","starred_url":"https://api.github.com/users/kylelemons/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kylelemons/subscriptions","organizations_url":"https://api.github.com/users/kylelemons/orgs","repos_url":"https://api.github.com/users/kylelemons/repos","events_url":"https://api.github.com/users/kylelemons/events{/privacy}","received_events_url":"https://api.github.com/users/kylelemons/received_events","type":"User","site_admin":false},"repo":{"id":3840932,"name":"gousb","full_name":"kylelemons/gousb","owner":{"login":"kylelemons","id":322213,"avatar_url":"https://avatars.githubusercontent.com/u/322213?v=3","gravatar_id":"","url":"https://api.github.com/users/kylelemons","html_url":"https://github.com/kylelemons","followers_url":"https://api.github.com/users/kylelemons/followers","following_url":"https://api.github.com/users/kylelemons/following{/other_user}","gists_url":"https://api.github.com/users/kylelemons/gists{/gist_id}","starred_url":"https://api.github.com/users/kylelemons/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kylelemons/subscriptions","organizations_url":"https://api.github.com/users/kylelemons/orgs","repos_url":"https://api.github.com/users/kylelemons/repos","events_url":"https://api.github.com/users/kylelemons/events{/privacy}","received_events_url":"https://api.github.com/users/kylelemons/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kylelemons/gousb","description":"Idiomatic Go bindings for libusb-1.0","fork":false,"url":"https://api.github.com/repos/kylelemons/gousb","forks_url":"https://api.github.com/repos/kylelemons/gousb/forks","keys_url":"https://api.github.com/repos/kylelemons/gousb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kylelemons/gousb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kylelemons/gousb/teams","hooks_url":"https://api.github.com/repos/kylelemons/gousb/hooks","issue_events_url":"https://api.github.com/repos/kylelemons/gousb/issues/events{/number}","events_url":"https://api.github.com/repos/kylelemons/gousb/events","assignees_url":"https://api.github.com/repos/kylelemons/gousb/assignees{/user}","branches_url":"https://api.github.com/repos/kylelemons/gousb/branches{/branch}","tags_url":"https://api.github.com/repos/kylelemons/gousb/tags","blobs_url":"https://api.github.com/repos/kylelemons/gousb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kylelemons/gousb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kylelemons/gousb/git/refs{/sha}","trees_url":"https://api.github.com/repos/kylelemons/gousb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kylelemons/gousb/statuses/{sha}","languages_url":"https://api.github.com/repos/kylelemons/gousb/languages","stargazers_url":"https://api.github.com/repos/kylelemons/gousb/stargazers","contributors_url":"https://api.github.com/repos/kylelemons/gousb/contributors","subscribers_url":"https://api.github.com/repos/kylelemons/gousb/subscribers","subscription_url":"https://api.github.com/repos/kylelemons/gousb/subscription","commits_url":"https://api.github.com/repos/kylelemons/gousb/commits{/sha}","git_commits_url":"https://api.github.com/repos/kylelemons/gousb/git/commits{/sha}","comments_url":"https://api.github.com/repos/kylelemons/gousb/comments{/number}","issue_comment_url":"https://api.github.com/repos/kylelemons/gousb/issues/comments{/number}","contents_url":"https://api.github.com/repos/kylelemons/gousb/contents/{+path}","compare_url":"https://api.github.com/repos/kylelemons/gousb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kylelemons/gousb/merges","archive_url":"https://api.github.com/repos/kylelemons/gousb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kylelemons/gousb/downloads","issues_url":"https://api.github.com/repos/kylelemons/gousb/issues{/number}","pulls_url":"https://api.github.com/repos/kylelemons/gousb/pulls{/number}","milestones_url":"https://api.github.com/repos/kylelemons/gousb/milestones{/number}","notifications_url":"https://api.github.com/repos/kylelemons/gousb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kylelemons/gousb/labels{/name}","releases_url":"https://api.github.com/repos/kylelemons/gousb/releases{/id}","deployments_url":"https://api.github.com/repos/kylelemons/gousb/deployments","created_at":"2012-03-27T06:09:15Z","updated_at":"2017-02-10T18:09:38Z","pushed_at":"2017-02-16T15:45:03Z","git_url":"git://github.com/kylelemons/gousb.git","ssh_url":"git@github.com:kylelemons/gousb.git","clone_url":"https://github.com/kylelemons/gousb.git","svn_url":"https://github.com/kylelemons/gousb","homepage":"http://gopkgdoc.appspot.com/pkg/github.com/kylelemons/gousb/usb","size":3240,"stargazers_count":63,"watchers_count":63,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":37,"mirror_url":null,"open_issues_count":6,"forks":37,"open_issues":6,"watchers":63,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kylelemons/gousb/pulls/32"},"html":{"href":"https://github.com/kylelemons/gousb/pull/32"},"issue":{"href":"https://api.github.com/repos/kylelemons/gousb/issues/32"},"comments":{"href":"https://api.github.com/repos/kylelemons/gousb/issues/32/comments"},"review_comments":{"href":"https://api.github.com/repos/kylelemons/gousb/pulls/32/comments"},"review_comment":{"href":"https://api.github.com/repos/kylelemons/gousb/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kylelemons/gousb/pulls/32/commits"},"statuses":{"href":"https://api.github.com/repos/kylelemons/gousb/statuses/a7f2e81ddffe8991d215a00b1d019227d7d778e1"}}}}
{"actor":{"display_login":"zagrodzki"}}