libusb for Android
==================

Building:
---------

To build libusb for Android do the following:

1. Download the latest NDK from:
    http://developer.android.com/tools/sdk/ndk/index.html

2. Extract the NDK.

3. Open a shell and make sure there exist an NDK global variable
    set to the directory where you extracted the NDK.

4. Change directory to libusb's "android/jni"

5. Run "$NDK/ndk-build".

The libusb library, examples and tests can then be found in:
    "android/libs/$ARCH"

Where $ARCH is one of:
    armeabi
    armeabi-v7a
    x86

Installing:
-----------

If you wish to use libusb from native code in own Android application
then you should add the following line to your Android.mk file:

include $(PATH_TO_LIBUSB_SRC)/android/jni/libusb.mk

You will then need to add the following lines to the build
configuration for each native binary which uses libusb:

LOCAL_C_INCLUDES += $(LIBUSB_ROOT_ABS)
  LOCAL_SHARED_LIBRARIES += libusb1.0

The Android build system will then correctly include libusb in the
application package (APK) file, provided ndk-build is invoked before
the package is built.

For a rooted device it is possible to install libusb into the system
image of a running device:

1. Enable ADB on the device.

2. Connect the device to a machine running ADB.

3. Execute the following commands on the machine
    running ADB:

# Make the system partition writable
    adb shell su -c "mount -o remount,rw /system"

# Install libusb
    adb push obj/local/armeabi/libusb1.0.so /sdcard/
    adb shell su -c "cat > /system/lib/libusb1.0.so < /sdcard/libusb1.0.so"
    adb shell rm /system/lib/libusb1.0.so

# Install the samples and tests
    for B in listdevs fxload xusb sam3u_benchmark hotplugtest stress
    do
      adb push "obj/local/armeabi/$B" /sdcard/
      adb shell su -c "cat > /system/bin/$B < /sdcard/$B"
      adb shell su -c "chmod 0755 /system/bin/$B"
      adb shell rm "/sdcard/$B"
    done

# Make the system partition read only again
    adb shell su -c "mount -o remount,ro /system"

# Run listdevs to
    adb shell su -c "listdevs"

4. If your device only has a single OTG port then ADB can generally
    be switched to using Wifi with the following commands when connected
    via USB:

adb shell netcfg
    # Note the wifi IP address of the phone
    adb tcpip 5555
    # Use the IP address from netcfg
    adb connect 192.168.1.123:5555

Runtime Permissions:
--------------------

The default system configuration on most Android device will not allow
access to USB devices. There are several options for changing this.

If you have control of the system image then you can modify the
ueventd.rc used in the image to change the permissions on
/dev/bus/usb/*/*. If using this approach then it is advisable to
create a new Android permission to protect access to these files.
It is not advisable to give all applications read and write permissions
to these files.

For rooted devices the code using libusb could be executed as root
using the "su" command. An alternative would be to use the "su" command
to change the permissions on the appropriate /dev/bus/usb/ files.

Users have reported success in using android.hardware.usb.UsbManager
to request permission to use the UsbDevice and then opening the
device. The difficulties in this method is that there is no guarantee
that it will continue to work in the future Android versions, it
requires invoking Java APIs and running code to match each
android.hardware.usb.UsbDevice to a libusb_device.

1.如果你可以重新编译系统的android,那么可以修改uevented.rc改变 /dev/bus/usb/*/*。文件的权限让其可以读写

2.对于已经root了的设备。可以直接在管理员权限下修改这个文件的权限。

安卓设备通过USB接口读取UVC摄像头权限问题的更多相关文章

  1. USB接口无法识别设备

    http://windows.microsoft.com/zh-cn/windows/answers?tId=14fa1e44-0a19-48ef-9ba7-b7e512a837a4 小琼子 提问 2 ...

  2. 记:联调安卓设备的神药-无需usb数据线即可直连

    前言 最近需要调试公司的安卓服务,正常情况下,我们调试都是减安卓设备通过usb连接在我们座位旁,再不济就是我们扛笔记本到硬件旁边,这样调试屡试不爽,但是有一天你突然发现你带的数据线因为各种原因总是终端 ...

  3. 笔记本USB接口案例分析和是实现

    笔记本电脑 笔记本电脑(laptop)通常具备使用USB设备的功能.在生产时,笔记本都预留了可以插入USB设备的USB接口,但具体是什么USB设备,笔记本厂商并不关心,只要符合USB规格的设备都可以 ...

  4. 安卓系统使用USB转串口

    概述 安卓系统支持多种 USB 外围设备,提供两种模式来支持实现 USB 外设接入系统:USB 配件模式和 USB 主机模式. 在 USB 配件模式下,接入的 USB 设备充当 USB 主机,并为 U ...

  5. 笔记本Usb接口案例

    笔记本电脑通常具备使用USB设备的功能.在生产的时候,笔记本都预留了可以插入USB设备的USB接口.但具体是什么USB设备,笔记本厂商并不关心,只要符合USB规格的设备都可以. 定义USB接口,具备最 ...

  6. 安卓添加USB外置UVC摄像头

    实现的方法有很多种,按步骤来看适合哪一种,网上说什么接采集卡,其实就是把AV转成UVC,现在市面上很多摄像头直接就已经是UVC的了,在windows上面即插即用. 安卓也是Linux,这个就好办了. ...

  7. shell判断USB接口是否有设备插入

    #/bin/sh usb_num=$(cat /proc/scsi/scsi | grep "Vendor" | wc -l)if [ $usb_num = 2 ];then    ...

  8. C#控制操控操作多个UVC摄像头设备

    有时,我们需要在C#代码中对多个UVC摄像头进行操作,如何实现呢? 建立基于SharpCamera的项目 首先,请根据之前的一篇博文 点击这里 中的说明,建立基于SharpCamera的摄像头控制项目 ...

  9. rockchip 3128 平台USB接口鼠标U盘功能调试日记

    2019-04-12 关键词: rk3128 OTG.rk3128外接鼠标U盘.RK外接鼠标U盘 本篇文章是笔者根据自己当前所掌握知识对 rk3128 平台 USB 接口接鼠标实现输入功能调试的一个记 ...

随机推荐

  1. angularJs实现信息数据提交功能

    如下简单的报名提交的实现 1.数据绑定 2.$http.post()提交数据 一.数据绑定 <!--报名部分--> <div class="attend_box" ...

  2. Maven-006-手动部署第三方构件至 nexus 私服

    某些 Java 构件因许可证因素,无法公开的部署到公共仓库中:或者,一些小型的开源项目(例如 SourceForge.GitHub 中的一些项目),没有将构件分发到中央仓库中,也没有维护自己的仓库,因 ...

  3. sql sp_xml_preparedocument 函数运用实例

    表结构: CREATE FUNCTION f_splitSTR( ), --待分拆的字符串 ) --数据分隔符 ))) AS BEGIN --创建分拆处理的辅助表(用户定义函数中只能操作表变量) DE ...

  4. 一种在视频OBJECT标签上放置均分四个区域的框选方法

    一般在视频区域中做框样式,作应由视频插件自己来实现,但是出于其它一些原因自己琢磨了一个使用HTML标签来实现框选区域的方法,按照行外应该属于笨方法,虽然有点笨,可能在其他方面有借鉴意义,在这里拿出来跟 ...

  5. (一) ARM 内存SDRAM 讲解

    2.SDRAM内存工作原理 上面产生的误解关于 Bank ,这个bank 不是 和 S3C2440 芯片有关系(RAM 自身有bank , SDRAM 自身也有bank ,就像书 有 好几章节一样) ...

  6. 手机触摸touch事件

    1.Touch事件简介 pc上的web页面鼠 标会产生onmousedown.onmouseup.onmouseout.onmouseover.onmousemove的事件,但是在移动终端如 ipho ...

  7. Spring MVC 学习资料

    引述要学习Spring框架的技术内幕,必须事先掌握一些基本的Java知识,正所谓“登高必自卑,涉远必自迩”.以下几项Java知识和Spring框架息息相关,不可不学(我将通过一个系列分别介绍这些Jav ...

  8. curl_init函数用法

    使用PHP的cURL库可以简单和有效地去抓网页.你只需要运行一个脚本,然后分析一下你所抓取的网 页,然后就可以以程序的方式得到你想要的数据了.无论是你想从从一个链接上取部分数据,或是取一个XML文件并 ...

  9. quick cocos2dx lua 内存释放

    前言 对于内存的优化,网上有很多例子和教程.总体来说,就那么几种解决方案,在最后我会简单提下,这里先说下在quick中,对于图片的处理. 1.查看内存调试信息 对于quick框架的了解,我们可以参考\ ...

  10. Eclipse安装SVN插件方式简明介绍

    一.Links安装: 推荐使用此种安装方式,因为它便于插件的管理. 在eclipse根目录下新建文件夹links,这样就得到了eclipse\links 在eclipse\links下新建一个link ...