usb-otg

USB host mode in Android device supporting OTG

我只是一个虾纸丫 提交于 2021-02-08 03:36:06
问题 I'd like to know in which mode a USB-OTG-supporting Android device is by default, - in the USB host mode or USB slave mode ? I guess, if the device is in slave mode, then there's no point of using API described on link below ? https://developer.android.com/guide/topics/connectivity/usb/host.html Is there a way to programmatically switch from host to slave mode and vice versa ? As you know, a USB OTG (On the go) device automatically switches to host or slave mode, depending on which end of an

Play Video using connected USB via OTG cable in Android?

萝らか妹 提交于 2020-01-12 06:01:33
问题 I want to ask that there are application available in which user can connect USB to Android via OTG cable device and play the media (specially videos) contained by it. i have made a Broadcast Receiver to detect the attached USB, i want to read the content also. I am using this code snippet. private final BroadcastReceiver mUsbReceiver = new BroadcastReceiver() { public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (UsbManager.ACTION_USB_DEVICE

How app can access files on USB OTG storages in Android 6.0 (API level 23) without root?

北战南征 提交于 2019-12-28 04:01:27
问题 Android 6.0 Developer Preview (API level 23) can natively mounts external removable USB OTG storages out-of-the-box without any additional apps (for more info please see: https://www.androidpolice.com/2015/05/28/android-m-feature-spotlight-external-storage-can-be-adopted-as-true-internal-storage-or-accessed-normally-with-no-additional-apps/). When user connects USB OTG storage, it shows up in the system storage menu and it is accessible with the built-in file manager. User can access all

Distinguish SDCard URI from USBStorage URI returned by SAF or StorageVolume API

穿精又带淫゛_ 提交于 2019-12-23 03:05:07
问题 I am using StorageVolume API to retrieve URI for both SDCard and USBStorage by following StorageManager storageManager = (StorageManager) getSystemService(STORAGE_SERVICE); for (StorageVolume storageVolume : storageManager.getStorageVolumes()) { if (!storageVolume.isPrimary()) { Intent accessIntent = storageVolume.createAccessIntent(null); startActivityForResult(accessIntent, 11); } } In onActivityResult I am able to retrieve the URI, saving it to the SharedPreferences and taking Persisting

How to detect if Android has full USB support or not?

南笙酒味 提交于 2019-12-20 02:15:31
问题 My application uses UsbManager to communicate with USB cameras. Some devices don't have USB support. These will return null for (UsbManager)context.getSystemService( Context.USB_SERVICE ) , or they will throw a NoSuchMethodError exception when enumerating devices. I can detect both and display a message properly. Unfortunately, some Androids that don't detect USB devices cause neither of these problems. They just return an empty list of USB devices. How can I properly detect that this system

Arduino being recognized as keyboard by android

纵然是瞬间 提交于 2019-12-13 04:59:59
问题 I wrote a simple firmware for arduino to replicate whatever incoming data it recieves on serial to the serial output. Something like this: int serialData = 0; void setup() { Serial.begin(9600); } void loop() { if (Serial.available() > 0) { serialData = Serial.read(); Serial.println(serialData); } } Now I wanted it connect to my Nexus 7 running on Android 4.3 using a microUSB->OTG cable + USB->microUSB cable. I installed a serial monitor app (https://play.google.com/store/apps/details?id=jp

USB OTG File Deletion

♀尐吖头ヾ 提交于 2019-12-13 03:20:33
问题 I have a device (an mp3 player) connected to the smartphone through the USB OTG cable. I am trying to find an SDK of some kind which provides some API for file deletion. Right now the only software that was able to work properly is OTG Disk Explorer Pro 3.02. I managed to redirect its debug messages into a file to be able to actually read it. Here is a log: 2019-02-01 11:43:14 :: ODE :: >==< Found device: 0781:74E8 Class 00:00 >==< 2019-02-01 11:43:14 :: ODE :: >==< Device under: /dev/bus/usb

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

六月ゝ 毕业季﹏ 提交于 2019-12-11 11:44:58
问题 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

read file from usb removable storage

痞子三分冷 提交于 2019-12-11 05:58:07
问题 in my application I want to read a file from usb removable storage I have a.txt and i want to read it void read() { UsbManager manager = (UsbManager) getSystemService(Context.USB_SERVICE); HashMap<String, UsbDevice> deviceList = manager.getDeviceList(); Iterator<UsbDevice> deviceIterator = deviceList.values().iterator(); StringBuffer sb = new StringBuffer(); while (deviceIterator.hasNext()) { UsbDevice device = deviceIterator.next(); String Model = device.getDeviceName(); try { File file =

Linux OTG port screwing up my other host port

落花浮王杯 提交于 2019-12-11 04:33:42
问题 I've got a Variscite VAR-SOM-MX6 running a Linux 3.0.35 kernel, with two USB ports. The first port is an OTG port connected to an external mini-OTG jack. The second is an internal host port going to a hub chip, and then to some other devices. If I've got an OTG cable plugged into the first port, telling it to be a host, then everything works fine. If I have a regular cable, or no cable at all, plugged in, then the second host port doesn't enumerate properly. There doesn't have to be anything