{"action":"created","issue":{"url":"https://api.github.com/repos/trezor/trezord-go/issues/104","repository_url":"https://api.github.com/repos/trezor/trezord-go","labels_url":"https://api.github.com/repos/trezor/trezord-go/issues/104/labels{/name}","comments_url":"https://api.github.com/repos/trezor/trezord-go/issues/104/comments","events_url":"https://api.github.com/repos/trezor/trezord-go/issues/104/events","html_url":"https://github.com/trezor/trezord-go/pull/104","id":362593635,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE3MjY3OTk5","number":104,"title":"libusb: Add cancel to sync.c, don't use timeouts","user":{"login":"karel-3d","id":104945,"node_id":"MDQ6VXNlcjEwNDk0NQ==","avatar_url":"https://avatars2.githubusercontent.com/u/104945?v=4","gravatar_id":"","url":"https://api.github.com/users/karel-3d","html_url":"https://github.com/karel-3d","followers_url":"https://api.github.com/users/karel-3d/followers","following_url":"https://api.github.com/users/karel-3d/following{/other_user}","gists_url":"https://api.github.com/users/karel-3d/gists{/gist_id}","starred_url":"https://api.github.com/users/karel-3d/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/karel-3d/subscriptions","organizations_url":"https://api.github.com/users/karel-3d/orgs","repos_url":"https://api.github.com/users/karel-3d/repos","events_url":"https://api.github.com/users/karel-3d/events{/privacy}","received_events_url":"https://api.github.com/users/karel-3d/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-09-21T12:29:13Z","updated_at":"2018-09-24T12:09:29Z","closed_at":null,"author_association":"MEMBER","pull_request":{"url":"https://api.github.com/repos/trezor/trezord-go/pulls/104","html_url":"https://github.com/trezor/trezord-go/pull/104","diff_url":"https://github.com/trezor/trezord-go/pull/104.diff","patch_url":"https://github.com/trezor/trezord-go/pull/104.patch"},"body":"The main reason why we used interrupt with timeouts is that we cannot cancel transfers, using the libusb synchronnous API.\r\n\r\nHowever, the repeated timeouts cause issues with the bootloader for unknown reasons.\r\n\r\nInstead of using timeouts, I added a function to cancel transfers to synch libusb API. Then we can safely remove the timeouts from the code, since we cancel the calls manually. (We cannot remove them completely - we still use them for finishing the read queue.)\r\n\r\nWhat I did not know before is that using libusb close on a device with pending synch transfers **does not cancel the pending transfers** - and the transfers then hang forever! (Also, libusb device close is a non-blocking function.)\r\n\r\n---\r\n\r\nThis is a little complex, but the other option would be to basically rewrite sync.c into go.\r\n\r\nUnfortunately this probably breaks FreeBSD again, since we add API to libusb.\r\n\r\n--- \r\n\r\nThis is a different approach to solving the timeout problems than this PR - https://github.com/trezor/trezord-go/pull/103 - and probably better. But it breaks compatibility with \"out of the box\" libusb."},"comment":{"url":"https://api.github.com/repos/trezor/trezord-go/issues/comments/423953076","html_url":"https://github.com/trezor/trezord-go/pull/104#issuecomment-423953076","issue_url":"https://api.github.com/repos/trezor/trezord-go/issues/104","id":423953076,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMzk1MzA3Ng==","user":{"login":"karel-3d","id":104945,"node_id":"MDQ6VXNlcjEwNDk0NQ==","avatar_url":"https://avatars2.githubusercontent.com/u/104945?v=4","gravatar_id":"","url":"https://api.github.com/users/karel-3d","html_url":"https://github.com/karel-3d","followers_url":"https://api.github.com/users/karel-3d/followers","following_url":"https://api.github.com/users/karel-3d/following{/other_user}","gists_url":"https://api.github.com/users/karel-3d/gists{/gist_id}","starred_url":"https://api.github.com/users/karel-3d/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/karel-3d/subscriptions","organizations_url":"https://api.github.com/users/karel-3d/orgs","repos_url":"https://api.github.com/users/karel-3d/repos","events_url":"https://api.github.com/users/karel-3d/events{/privacy}","received_events_url":"https://api.github.com/users/karel-3d/received_events","type":"User","site_admin":false},"created_at":"2018-09-24T12:09:29Z","updated_at":"2018-09-24T12:09:29Z","author_association":"MEMBER","body":"Only now I found out that windows build throws some warnings.... I will look at that later"}}
{"actor":{"display_login":"karel-3d"}}