{"action":"created","issue":{"url":"https://api.github.com/repos/saki4510t/UVCCamera/issues/42","repository_url":"https://api.github.com/repos/saki4510t/UVCCamera","labels_url":"https://api.github.com/repos/saki4510t/UVCCamera/issues/42/labels{/name}","comments_url":"https://api.github.com/repos/saki4510t/UVCCamera/issues/42/comments","events_url":"https://api.github.com/repos/saki4510t/UVCCamera/issues/42/events","html_url":"https://github.com/saki4510t/UVCCamera/issues/42","id":134320910,"number":42,"title":"Random could not open camera with errors -2 and -50","user":{"login":"btut","id":10479048,"avatar_url":"https://avatars.githubusercontent.com/u/10479048?v=3","gravatar_id":"","url":"https://api.github.com/users/btut","html_url":"https://github.com/btut","followers_url":"https://api.github.com/users/btut/followers","following_url":"https://api.github.com/users/btut/following{/other_user}","gists_url":"https://api.github.com/users/btut/gists{/gist_id}","starred_url":"https://api.github.com/users/btut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/btut/subscriptions","organizations_url":"https://api.github.com/users/btut/orgs","repos_url":"https://api.github.com/users/btut/repos","events_url":"https://api.github.com/users/btut/events{/privacy}","received_events_url":"https://api.github.com/users/btut/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-02-17T15:59:04Z","updated_at":"2016-02-20T03:43:36Z","closed_at":null,"body":"Hi saki,\r\nI am having problems with a camera of mine. Sometimes it works fine, other times not (error message: could not open camera:err=-2 or -50). I cannot distinguish any dependencies on other circumstances, sometimes the error is thrown, other times the preview is ok.\r\nInformation: I am using an edited version of sample 7, but the error -2 shows up in an unchanged version of sample 7 as well.\r\nI can not figure out what the errors mean, do you have an idea?\r\n\r\nAlso, in my version I do not want any user interface. If a camera is connected, the preview should start on any free surface (max 2 at a time). However I noticed that in the onAttach Method of the OnDeviceConnectListener Interface I implemented, I always get device == null. I have to iterate through all connected devices with:\r\n`for(UsbDevice d : mUSBMonitor.getDeviceList())`\r\nand request permission for all of them. Do you have an idea why the method is not called with the device that was most recently connected but with null instead?\r\n\r\nThanks in advance for your help!"},"comment":{"url":"https://api.github.com/repos/saki4510t/UVCCamera/issues/comments/186500447","html_url":"https://github.com/saki4510t/UVCCamera/issues/42#issuecomment-186500447","issue_url":"https://api.github.com/repos/saki4510t/UVCCamera/issues/42","id":186500447,"user":{"login":"saki4510t","id":6743409,"avatar_url":"https://avatars.githubusercontent.com/u/6743409?v=3","gravatar_id":"","url":"https://api.github.com/users/saki4510t","html_url":"https://github.com/saki4510t","followers_url":"https://api.github.com/users/saki4510t/followers","following_url":"https://api.github.com/users/saki4510t/following{/other_user}","gists_url":"https://api.github.com/users/saki4510t/gists{/gist_id}","starred_url":"https://api.github.com/users/saki4510t/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saki4510t/subscriptions","organizations_url":"https://api.github.com/users/saki4510t/orgs","repos_url":"https://api.github.com/users/saki4510t/repos","events_url":"https://api.github.com/users/saki4510t/events{/privacy}","received_events_url":"https://api.github.com/users/saki4510t/received_events","type":"User","site_admin":false},"created_at":"2016-02-20T03:43:36Z","updated_at":"2016-02-20T03:43:36Z","body":"Hi,\r\nIt depends on where/when the error occurs.\r\n\r\nAs I can see your comment, I assume your issue seems to relate to timing of initialization and hardware of your device/camera. Did you try to initialize camera manually one by one? If manual initialization works well on both camera, it may be better to start camera sequentially, one by one using semaphore, synchronize etc. Because initialization and starting preview run on `CameraHander`, simultaneously on worker thread.\r\n\r\nI'm not sure your actual implementation, did you start camera after creation of `SurfaceTexture`?\r\n`usbcameratest7` is just sample and primarily intended to start camera by manual. And most of error checks are omitted from it's code.\r\nsaki"}}