Giter Site home page Giter Site logo

onAttach(UsbDevice device) about uvccamera HOT 2 CLOSED

saki4510t avatar saki4510t commented on August 11, 2024
onAttach(UsbDevice device)

from uvccamera.

Comments (2)

saki4510t avatar saki4510t commented on August 11, 2024

Hi,
Thank you for providing feedback.
As I know some old devices with old Android never send attach event to app defined broadcast receiver but I think most of ATOM devices will work. Does your app start when you connect UVC camera to your device?

FYI,

  1. When app defines intent filter in it's AndroidManifest.xml to request attach event so that app can get permanent permission, Android system launches the app and send intent to main activity(instead of broadcast receiver) when user connects UVC device and gives permission.
  2. When app register USBMonitor, USBMonitor registers it's broadcast receiver to Android system.
    As I mentioned, some old devices with old Android never send attach event to broadcast receiver and I don't add intent filter for 'attach' event to this broadcast receiver and use polling method instead to avoid race condition. But you can try to add attach intent filter so that broadcast receiver listen the event by adding filter.addAction(UsbManager.ACTION_USB_DEVICE_ATTACHED); to register method.
  3. USBMonitor post mDeviceCheckRunnable in register method to detect UVC device(s) periodically using polling method. This will cause race condition if you add intent filter for attach event and onAttach will be called multiple times(may be called on arbitrary thread). You need to access UVC device exclusively or remove either intent filter or mDeviceCheckRunnable.
  4. mDeviceCheckRunnable checks number of connected USB device(s) with applying device filter and calls onAttach if number of connect USB device increase. And then post itself for next check.

saki

from uvccamera.

dknee avatar dknee commented on August 11, 2024

Hi Saki,
"Does your app start when you connect UVC camera to your device? " Yes this does happen,

I have not had a chance to try your other suggestions. I upgraded from my Acer tablet to a RCA Viking Pro 10.1 tablet since it has two USB ports. I have not had a chance to investigate the use of these ports since I can not get the Google USB driver to work on my PC with this tablet.

from uvccamera.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.