{"action":"created","issue":{"url":"https://api.github.com/repos/mossmann/hackrf/issues/163","labels_url":"https://api.github.com/repos/mossmann/hackrf/issues/163/labels{/name}","comments_url":"https://api.github.com/repos/mossmann/hackrf/issues/163/comments","events_url":"https://api.github.com/repos/mossmann/hackrf/issues/163/events","html_url":"https://github.com/mossmann/hackrf/issues/163","id":64248459,"number":163,"title":"Detach the kernel driver automatically","user":{"login":"ao2","id":1249395,"avatar_url":"https://avatars.githubusercontent.com/u/1249395?v=3","gravatar_id":"","url":"https://api.github.com/users/ao2","html_url":"https://github.com/ao2","followers_url":"https://api.github.com/users/ao2/followers","following_url":"https://api.github.com/users/ao2/following{/other_user}","gists_url":"https://api.github.com/users/ao2/gists{/gist_id}","starred_url":"https://api.github.com/users/ao2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ao2/subscriptions","organizations_url":"https://api.github.com/users/ao2/orgs","repos_url":"https://api.github.com/users/ao2/repos","events_url":"https://api.github.com/users/ao2/events{/privacy}","received_events_url":"https://api.github.com/users/ao2/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-03-25T11:36:50Z","updated_at":"2015-04-08T09:20:27Z","closed_at":null,"body":"Hi,\r\n\r\nI saw some complaints about the kernel driver interfering with libhackrf:\r\nhttps://twitter.com/michaelossmann/status/579303581829988352/photo/1\r\n\r\nThere is a fairly easy solution to that, also proposed by the kernel driver developer: let libusb detach the kernel driver.\r\n\r\nHere is a patch which can be applied with ```git am```:\r\nhttp://ao2.it/tmp/0001-Automatically-detach-reattach-the-kernel-driver-if-l.patch\r\n\r\nI only compiled-tested the patch, I don't have a hackrf myself.\r\n\r\nif you want you can amend it to use ```true``` instead of ```1``` but I used ```1``` because that's what libusb expects.\r\n\r\nCiao,\r\n   Antonio"},"comment":{"url":"https://api.github.com/repos/mossmann/hackrf/issues/comments/90858644","html_url":"https://github.com/mossmann/hackrf/issues/163#issuecomment-90858644","issue_url":"https://api.github.com/repos/mossmann/hackrf/issues/163","id":90858644,"user":{"login":"dominicgs","id":91747,"avatar_url":"https://avatars.githubusercontent.com/u/91747?v=3","gravatar_id":"","url":"https://api.github.com/users/dominicgs","html_url":"https://github.com/dominicgs","followers_url":"https://api.github.com/users/dominicgs/followers","following_url":"https://api.github.com/users/dominicgs/following{/other_user}","gists_url":"https://api.github.com/users/dominicgs/gists{/gist_id}","starred_url":"https://api.github.com/users/dominicgs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dominicgs/subscriptions","organizations_url":"https://api.github.com/users/dominicgs/orgs","repos_url":"https://api.github.com/users/dominicgs/repos","events_url":"https://api.github.com/users/dominicgs/events{/privacy}","received_events_url":"https://api.github.com/users/dominicgs/received_events","type":"User","site_admin":false},"created_at":"2015-04-08T09:20:27Z","updated_at":"2015-04-08T09:20:27Z","body":"@ao2 You're right, both are defined from 1.0.18 onwards, unfortunately debian/ubuntu/kali all ship 1.0.17.  Most users who see this problem are running kali.  I think checking for both is probably a good idea, given that we are likely going to have to span the time when ```LIBUSBX_VERSION``` is removed and some people are still running code without ```LIBUSB_VERSION```.\r\n\r\nI'm also concerned about the order of calls to libusb.  First we open the device, then we set the configuration and then we claim the interface.  Can we set the configuration if the kernel is attached to an interface?  Having added in some debug logging, it appears as though ```libusb_set_configuration``` is returning ```LIBUSB_ERROR_BUSY```.\r\n\r\n"}}