Android USB and motion sensor - Java for Android App Development

Hey!
I have an USB motion sensor that I am trying to connect with my phone. I have made an simple APP that connects and enumerates USB devices, but for some reason I cant get this sensor connected. If I connect USB keyboards, mice, headsets, flash drives... everything else shows up perfectly, just not this sensor.
Im on a HTC One. I have an OTG cable, an powered usb hub, external power for the sensor and have even rooted my phone.
With an app called "USB Device Info" (../store/apps/details?id=aws.apps.usbDeviceEnumerator&hl=en), which shows connected devices under 2 tabs, "Android" and "Linux" (under Linux tab there are devices parsed from /sys/bus/usb/devices/), the sensor shows up. Under "Android", nothing.
But I have no idea what to do next. I need to be able to send commands to the sensor and read the answers. Need help

Related

usb external mouse

Hi I have a xenarc car-audio device (touch screen monitor, rca/dvi/vga inputs, line in from pc, USB out to connect to pc 4 touch input).
Instead of buying a small pc and place it somewhere in the trunk with loads of cables, I could use the audio/video out from the SGS and stick with it.
The problem is... I'd like to use the touch screen on the xenarc! So, is there a way to put the phone in host mode and connect the touch screen? Or simply connect an external mouse? What would I need, I mean, would I need to code the driver myself or the feature is already present in the os?
Thanks

Is it possible to use a usb mouse through DX's usb port?

I understand that there is a hardware mod that allows you to use other usb devices on the droid-x.
http://forum.xda-developers.com/showthread.php?t=726210
The phone on that thread is the Moto Milestone, will the exact same mod work for the Droid-X?
Also, do I have to write any new drivers for it recognize the mouse or is the linux "absolute mouse" drivers already part of the OS?
thanks in adv!
bump to see if anyone has tried this on the droid-x, don't want to cut up a couple cables and know that it doesn't work
last bump before cutting up the wires and verifying myself
This requires USB host mode - does the DX have that?
I tried it last night and follow the instructions to the T but it doesn't work. Booted of the micro usb, removed it right when the moto logo disappears and when I plug in a usb mouse, nothing happens. I don't see the mouse being powered at all ...
Any suggestions or thoughts?

Some OTG functions work, others don't?

I've got a D800 LG G2, and I'm having issues with some USB OTG features.
I have a generic USB OTG cable (just USB, no Y connector for power), and up until a month or so ago, it was working perfectly fine.
I was able to use USB flash drives, USB keyboard/mice, my wireless USB headset, my USB mic (Blue Snowball), and my USB wireless Xbox 360 controller receiver.
However, about a month ago, I tried to use a few USB devices, and it was not working properly.
This is what works now:
USB Audio (headset, and microphone) However, my headset's built-in buttons and volume wheel, which previously worked (for pause, and volume), now only act as "select", activating whichever option/app/icon is selected on the screen (almost like a keyboard would)
USB Flash drives somewhat work. I can see the files, but only with ES File Explorer, but it treats it as read-only. I have tried multiple drives.
USB Keyboard/mouse work as normal
My 360 controller does not work at all, but the receiver powers up and the controller appears to sync to it.
OTG Troubleshooter, from the Play Store, shows "USB Host Support" and "Hub USB Device Detected in Android" checked, but shows "No USB Device Detected in Linux"
This does not change regardless of what device I plug in.
Information about my device:
LG G2 D800
Stock Android 5.0.2 (Rooted), ver. D80030f
Kernel Version: Dorimanx 3.4.112 V11.1-LG-D800-PWR-Core+
Dorimanx Profile is set to Performance, CPU max speed set to 2572MHz
Nothing is overheating
I have not tried a whole lot to fix this; I couldn't find much information, and I'm not sure where to start with troubleshooting OTG.

[Q] USB OTG behaviour

Hi,
So I'm developing an app to communicate over serial with a HID and testing on the g6 is proving troublesome.
The scene:
-Hid/USB Permissions granted
-Device filter correct and working as intended
-Goal is to send a string over serial.
Allthough I'm 100% sure my test code is correct, the app cannot open a serial port.
Is it normal behaviour in recent versions of android for the device to recognise an otg cable as a power source? Even with no other device connected? Are there any known issues opening serial ports on the g6? (7.0)
The cable works as intended when I plug a mouse or keyboard in but refuses to open a serial connection when my takget device is plugged in. It recognises it as a HID an can pull the serial number etc.
The android serial library should not require root or any other hackery So I'm a bit confused. I've ordered a few other otg adapters just in case.
Anyone who knows what might be going on pleas pitch in.
I've had some issues getting a serial adaptor working as well. I'm on 870DS. Originally tried the wired version of this:
https://forum.xda-developers.com/an...odemu-connect-android-to-30pin-t3234840/page1
Thank God the developer changed to Bluetooth. I tried about 6 different otg cables. Worked fine on other non usb-c phones.
I suspect it is the adapter too...sucks so bad. The annoying thing is that I was so confident in android serial that I wrote a lot of code before I bothered testing the concept lol.
Does your OTG work on memory sticks OK? I have a G6 h870ds. My OTG only works for me with USB3 OTG adapters and USB3 memory sticks. I don't have a USB3 HID device to try. I now have a large collection of different OTG adapters and memory sticks. I opened up some of the adapters to buzz them through to make sure they were made correctly. They were! It took a while for the penny to drop why some things worked and some didn't!
I cant use USB2 OTG adapters or USB2 memory sticks, keyboards or cameras. Initial connection of the USB2 OTG adapter is recognized but no connected devices are detected. I used an app called USB Device Info that can give me details of detected devices and only USB3 devices are ever detected.
I have a USB2 memory stick with an LED on it. When it is first connected to the OTG cable it flashes in a way that leads me to think it is trying to reply to USB bus interrogation but something (probably software) fails. The phone connects to my USB2 PC port just fine so I don't think the hardware is at fault. I've reset the phone and upgraded to Oreo too but alas that didn't help.
A friend of mine has a G6 H870S and all my adapters and memory stick combinations work fine on his phone so I find myself wondering if I'm just unlucky or whether the dual sim version is subtly different in some way.
I fully admit I know nothing about the inner workings of USB but as far as I can determine USB3 uses all of the USB2 connections and the additional connections only available on a USB3 port so the hardware should be OK. I'm guessing most HID devices are USB2 but if its a USB3 could you possible have a related problem but in reverse?
Every time I plug in any USB OTG adapter I get that same pop up screen that defaults to select as "power supply" even with no device connected whatever I have previously chosen.
What works for me is to plug in the OTG adapter, and only then plug in the memory stick to it. Otherwise I get the "Power supply" thing too.
Arak0n said:
What works for me is to plug in the OTG adapter, and only then plug in the memory stick to it. Otherwise I get the "Power supply" thing too.
Click to expand...
Click to collapse
Leaving just the OTG adapter connected for a few seconds then attaching the usb device does not help. USB2 devices are never detected but all my various USB3 memory sticks work reliably when using a USB3 spec adapter. I've given up worrying about it now and accepted that there is just something a bit iffy about my G6.

Data Recovery From Ph-1 with non-fruntioning screen

My PH-1's screen died randomly and I'm trying to get my data off of it. Yes I know, shame on me for not regularly backing things up. I reached out to Essential and they suggested I purchase a HDMI to usb-c cable. When plugging in the cable on my replacement device everything looks great, but unfortunately the screen is oddly cropped when plugging in my old broken phone.
So, I'm looking for some help on how I might be able to get all my data off with my laptop. My current challenges are that the phone is locked and since I restarted the phone, my fingerprint isnt sufficient. I don't have debugging enabled nor do I have bootloader. I did enable developer options at some point before the screen went black though.
Any help would be greatly appreciated.
Snow27118 said:
My PH-1's screen died randomly and I'm trying to get my data off of it. Yes I know, shame on me for not regularly backing things up. I reached out to Essential and they suggested I purchase a HDMI to usb-c cable. When plugging in the cable on my replacement device everything looks great, but unfortunately the screen is oddly cropped when plugging in my old broken phone.
So, I'm looking for some help on how I might be able to get all my data off with my laptop. My current challenges are that the phone is locked and since I restarted the phone, my fingerprint isnt sufficient. I don't have debugging enabled nor do I have bootloader. I did enable developer options at some point before the screen went black though.
Any help would be greatly appreciated.
Click to expand...
Click to collapse
Without USB debugging (ADB) and a locked BL, your options don't really exist.
If the digitizer still works you might be able to plug the phone into a screen and unlock it and see enough to enable USB debugging.
tech_head said:
Without USB debugging (ADB) and a locked BL, your options don't really exist.
If the digitizer still works you might be able to plug the phone into a screen and unlock it and see enough to enable USB debugging.
Click to expand...
Click to collapse
Is it possible to plug into a computer or only a tv? I plugged it into three different TV's, but every time the projected image of my phone was cropped and incomplete. I'm not able to see the entire numeric keyboard, but think I might be able to estimate if I could use a mouse.
I purchased two mice. One regular old USB mouse and a Bluetooth dongled mini remote keyboard with touchpad (h9). The USB mouse isn't recognized at all by the tv. The mini keyboard is recognized by the tv and I'm able to use it in Netflix ECT but when I'm connected to the phone in HDMI mode it displays a little message saying "not supported" when I try to use it. The tv is a Samsung smart TV that's about a year and a half.
Am I missing anything? Some other way of controlling the phone while plugged into the tv or a way connecting it to my PC and controlling it with my PC?
Snow27118 said:
Is it possible to plug into a computer or only a tv? I plugged it into three different TV's, but every time the projected image of my phone was cropped and incomplete. I'm not able to see the entire numeric keyboard, but think I might be able to estimate if I could use a mouse.
I purchased two mice. One regular old USB mouse and a Bluetooth dongled mini remote keyboard with touchpad (h9). The USB mouse isn't recognized at all by the tv. The mini keyboard is recognized by the tv and I'm able to use it in Netflix ECT but when I'm connected to the phone in HDMI mode it displays a little message saying "not supported" when I try to use it. The tv is a Samsung smart TV that's about a year and a half.
Am I missing anything? Some other way of controlling the phone while plugged into the tv or a way connecting it to my PC and controlling it with my PC?
Click to expand...
Click to collapse
When I plug my phone into a monitor the monitor will rotate and the phone scales the display.
I'm using a cheap TopGeek adapter I got from Amazon.
Once you get the display stuff figured out. You should be able to unlock on the phone.
Then you can go in and enable developer debugging for ADB.
Or you can then pair a mouse and keyboard via Bluetooth.
tech_head said:
When I plug my phone into a monitor the monitor will rotate and the phone scales the display.
I'm using a cheap TopGeek adapter I got from Amazon.
Once you get the display stuff figured out. You should be able to unlock on the phone.
Then you can go in and enable developer debugging for ADB.
Or you can then pair a mouse and keyboard via Bluetooth.
Click to expand...
Click to collapse
For some reason my tv isn't scaling the display of my old phone but does with my replacement. Are you using a computer monitor? And are you able to plug a mouse into the monitor to control the phone?
Snow27118 said:
For some reason my tv isn't scaling the display of my old phone but does with my replacement. Are you using a computer monitor? And are you able to plug a mouse into the monitor to control the phone?
Click to expand...
Click to collapse
Not sure wh one would scale and the other would not.
I'm using a computer monitor.
My monitor does not support USB order HDMI. It's not a native USB-C monitor,

Categories

Resources