问题标签 [usb-otg]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
6355 浏览

android - 在 Android 中通过 OTG 电缆使用连接的 USB 播放视频?

我想问有没有应用程序,用户可以通过 OTG 电缆设备将 USB 连接到 Android 并播放它包含的媒体(特别是视频)。

我制作了一个广播接收器来检测连接的 USB,我也想阅读内容。我正在使用这个代码片段。

我想做这样的申请。

有人对此有什么想法吗?

0 投票
0 回答
990 浏览

android - 记住 Android 5.0 上的 USB 权限

我有一个使用 OTG 连接连接到 USB 设备的 android 应用程序。插入设备时,它会显示一个弹出窗口,您可以在其中选择允许和一个复选框,您可以在其中记住此决定。我遇到了一个它不记得权限的问题,如本主题中所述:

USB设备访问弹出抑制?

主题中给出的解决方案完美地解决了我安装了 android 4.4.4 的 Moto G 的问题。作为副作用,只要记住权限,它就会在应用程序未打开并且连接设备时启动应用程序,这很酷!

但是,当我在我的 Sony Xperia Z1 Compact 上使用 android 5.0.2 尝试相同的操作时,它不记得我的偏好,应用程序也不会自动启动,并且每次应用程序请求权限时都会弹出对话框。所以看起来记住复选框不起作用!

我的清单中的活动:

配置.xml:

所以要清楚;这在我的 4.4.4 手机上按预期工作,但在我的 5.0.2 手机上不起作用。对我来说,这似乎是一个与 android 5 相关的问题,权限可能会有所不同。这是否可以在我的清单中以某种方式修复?

0 投票
2 回答
2684 浏览

android - How to get the file path from a device acting as a usb mass storage in android

I am trying to get filenames(and also the filepath), from a Garmin device which acts as a usb mass storage. Connecting the device to the computer, the filepath is G:\Garmin. Connecting that to the android tablet using OTG and Explorer(i have check the app setting - the package name is : com.android.rk), the filepath is USB/Garmin. Using ES File Explorer, I have seen that the file path is mnt/usb_storage/Garmin. So in the code, as I am trying to parse the system.xml from the file path usb_storage/Garmin, I have put the filepath like this:

When I run the app, it crashes, meaning that it cannot find the file system.xml. Is it right that I use Environment.getExternalStorageDirectory() when I'm looking for the file in a usb device connected via OTG? Can you please point me to what should be done? Thank you so much.

0 投票
1 回答
4623 浏览

microcontroller - 在微控制器方面,USB 主机与 USB OTG 支持有什么区别?

该微控制器在此处声称具有 USB 主机、设备和 OTG 支持。它是 ST Microelectronics 的 STM32F411CEU6。

虽然来自 Atmel(ATSAM3X8C)的这个只是声称充当 USB 主机和设备。

我认为任何可以充当设备和主机的芯片都可以用来实现 OTG 功能。我对吗?还是微控制器应该明确支持 OTG 功能?

PS:上面的2个芯片只是样品,第二个说它支持数据表中的OTG,正如Jonny_boy所说(是的!坏样品,但现在我不能改变它!!)。但问题仍然存在。

0 投票
1 回答
3640 浏览

java - Transfer Files USB Mass Storage OTG

I have an external mass storage device connected to an Android device. There are several .BIN files in the root directory that I need to read into my app. I am able to connect to the device and receive usb permission using UsbDeviceConnection.

Once I'm connected I am able to see that I have one Mass Storage interface with 2 Bulk Transfer endpoints (one in, one out).

When using usbConnection.bulkTransfer I receive -1 back and an empty buffer. So, I'm having trouble receiving data. Once past that hurdle, what will the data look like? How do I continue to pull all of the files from the device? Is there a way to transfer the data file by file to my app? Is there an all together better way of approaching this?

0 投票
1 回答
646 浏览

android - 在 Android 上通过 USB 主机模式访问相机存储

我正在尝试使用我的 OTG 电缆通过 USB 主机访问我的 DSLR 上的 SD 卡。我相信这是通过 PTP 实现的。我见过几个应用程序也可以在没有 root 权限的情况下执行此操作,他们不仅可以访问它,还可以控制快门速度和其他东西。但我只对访问 DSLR 上的 SD 卡感兴趣。连接到 USB 设备后我卡住了。见附件代码

有人可以告诉我如何阅读然后最终将照片从 DSLR 的 SD 卡下载到我的 android 应用程序。

更新

所以我尝试了这个库https://github.com/mjdev/libaums

它很棒,但问题是它只支持 USB 大容量存储。它不会识别我的相机存储。

任何帮助表示赞赏。

0 投票
0 回答
132 浏览

android - SD卡路径未指向

我有需要与 SD 卡、USB 驱动器、Dropbox 同步操作的应用程序。我成功实现了 Dropbox 同步,但在使用 SD 卡和 USB 时卡住了。当我尝试检索外部存储路径时,它总是返回内部存储路径。如果存在 SD 卡,我应该如何指向 SD 卡路径。

在此处输入图像描述

0 投票
1 回答
1102 浏览

android - 使用 mount 命令在 SnapdragonAPQ8074 中安装 USB 驱动器

我用root登录并将usb3.0连接到snapdragon板的usb3.0端口,当我检查日志时检测到:

并尝试使用以下命令安装它:

它显示错误:'安装:没有这样的设备'

0 投票
1 回答
2316 浏览

android - How to check whether Android device supports OTG features programatically

I want to check whether a device supports OTG features programatically . I have tried a lot about this in Internet but could not find any thing .

How can I do that ?

0 投票
0 回答
376 浏览

android - 如何在 android 的 OTG 上使用相机

我正在开发一个必须同时使用两个外部摄像头的 android 应用程序。我想知道如何使用相机。我经历了许多其他答案,但不清楚。我想知道如何在android中使用相机