[Q] android phone as a bluetooth HID - Android Software Development

Hello guys,
I want to write an app that registers my android phone as a HID through bluetooth to my PC. I have found many descriptions how I can connect a bluetooth keyboard or mouse to an android phone but no working solution doing generally the opposite.
The most helpful so far was groups.google.com/group/android-developers/browse_thread/thread/73f03a22963b356d, but as you can see there also isn't any solution provided.
So is it currently even possible doing this with android? Could there be a way using the underlying BlueZ with the NDK?
Any hints and help would be much appreciated.

I'm currently working on something related, which is connecting an android phone to a PS3.
You can look in /system/etc/bluetooth, notably the main.conf file, in which you'll find a Device class definition. I yet have to try to change it, to see if it changes the way the device is recognized by others
Hope this will help.

Related

Help with bluetooth! hci_get_route returns ERNODEV

Hi!
I am developing an application which connects a Wiimote to a bluetooth enabled android phone/device.
I did this by interfacing with the native bluez bluetooth library directly, rather than via the Android API. The reason for this is that Android API doesn't support HID devices, which a Wiimote is.
A problem now is that on some devices, mostly those sold by HTC, my app simply doesn't work. After calling the hci_get_route(NULL), this function should return an id of the first bluetooth device available (most likely 0), but instead returns ERNODEV (-1) as if no bluetooth device is available.
I suspect it has something to do with our beloved HTC grossly modifying something in the libbluetooth library to make this fail to work.
Has anyone ever done this kind of bluetooth interfacing?
How could I make this work?
Rooting the phone and replacing a library or two would be fine too.
For a list of working and non-working devices, check out the 2nd post of this thread.
HTC support
I just sent a customer service message to HTC about this issue. I hope they can get back to me with a "we'll work on it" message, or something. I really want this on my incredible. I'm new to coding like this, but could you disguise the Wiimote as another kind of device?
Just a response from someone equally interested in a solution. I'm trying to set up a bluetooth keyboard (Freedom Pro) with my gsm Hero running the 1.5 based MCR 3.2. Available drivers (Freedom's own, BlueInput & KeyPro) should work with 1.5, but HTC devices, especially the Hero, seem to be lacking something that is present in most 1.5 builds.
Investigating, I find the same issue of no route to device, because there is no known device. AIUI when bluetooth is turned on hciattach is used to establish a link to the hardware. At that point an hciconfig should list the hci0 device as present but down. However I find this list remains empty at all times.
I found this for keyboards.
Since I can't post the link, it's called "KeyPro for Android"
Google "keypro android" and click the first link.
Maybe that could help. It says it works with any android device above 1.5, however, I did read that some keyboards use a different type of bluetooth profile, SPP rather than HID.
I haven't heard back form HTC yet either.
EDIT: Upon reading your post again, you have tried this. Sorry, my bad.
Thanks for looking though The Freedom Pro is switchable between spp & hid profiles, so I figured I was safe, lol. Not with HTC's butchered 1.5 bt it seems.
Did you ever try to use the most likely id 0 on an HTC device? Even though the call to get the id fails?
Maybe you could use also the Android API to synchronize if a device is present and then use the id that Android API gives you?
Just some thoughts since I would love to see that App running on my Desire with Snesoid
Edit: Double post
tobren said:
Did you ever try to use the most likely id 0 on an HTC device? Even though the call to get the id fails?
Maybe you could use also the Android API to synchronize if a device is present and then use the id that Android API gives you?
Just some thoughts since I would love to see that App running on my Desire with Snesoid
Click to expand...
Click to collapse
Believe it or not, I actually tried this. Unfortunately, the next command (to bind the bluetooth adapter) also fails, and of course every command after that one because the adapter is not bound.
Thanks for the idea anyway.
usb
does the wii remote have usb connectivity? could it be possible to have the communication pass through that connection rather than bluetooth? one advantage of this would be increased battery life and probably better compatibility across models.
i'm sure some people would prefer bluetooth, but i figure i'll always be using it very close to my phone so i can see the screen, so the wired option is actually a bit more attractive (considering battery performance).
i know ps3 has usb connectivity as well, you just might need an adapter (mini to micro).
rubber soul said:
does the wii remote have usb connectivity? could it be possible to have the communication pass through that connection rather than bluetooth?
[snip]
i know ps3 has usb connectivity as well, you just might need an adapter (mini to micro).
Click to expand...
Click to collapse
I'm pretty sure the first answer is no - our wii is round at a friend's atm. However even if it was yes, you'd need more than an adapter. USB operates with one device as master & the other as slave. To allow you to connect slave devices to your phone it would need to be in host mode. Some mobile phone hardware implementations support this, however I don't know of any mainstream Android kernels which do. Even if you workaround that, you're left with the huge issue that slave devices can assume it's safe to draw power from the USB bus which could do nasty things (tm) to a lower power device like a mobile. This can be worked around via a powered hub, but it all gets very messy.
I looked into this a few months ago, hoping I'd be able to use a usb keyboard with my Hero. I ended up with a BT keyboard instead. Of course that doesn't work either but for completely different reasons, as hinted at by this thread. Hopefully a 2.1 ROM will solve that, but that's the subject of numerous other threads.
Uh, just throwing stuff out, what if you have a pc with two bluetooth adapters, it connects to the wii mote, and then broadcasts that in someway the android api can understand?
Also please actually try working on something with a rooted phone, the HTC EVO 4g is rootable, and I will make man love(no homo) if you get it working.
Either one works lol.
Using a PC as a proxy is kind of useless. If you have a wiimote connected to a PC, you might as well play games on the PC itself (there are nes/snes/sega/etc emulators for PCs too).
At this moment, rooting doesn't help with the problem either.
@1 True
@2 That sucks.
Do we think that this will/could be fixed in HTC's Froyo update for 2010 devices? Not looking for definite answers, just a ponderin'.
well if you send the null pairing code to the wiimote from the default bluetooth pairing screen.. it will fail to communicate with the wiimote too
waffles004 said:
Do we think that this will/could be fixed in HTC's Froyo update for 2010 devices? Not looking for definite answers, just a ponderin'.
Click to expand...
Click to collapse
Doesn't it work in stock/vanilla Eclair? I thought the main problem was with Cupcake, though HTC seem to have done weird things to every stock firmware. I read that removing Sense from a 2.1 HTC ROM breaks bluetooth. Go figure. And there was I thinking Sense was a gui enhancement
I contacted HTC about their bluetooth issues and just received this response
My name is Courtney, and I would be glad to assist you today. I understand that you are unhappy with the Bluetooth connectivity on your HTC EVO. HTC is aware of the problems occurring with the EVO and Bluetooth. We are currently investigating this issue and are working on a solution. As soon as we have an update, we will inform our customers. Thank you for contacting HTC America Technical Support. If you need further assistance, please feel free to contact us via email or at 1-866-449-8358. We are open 7 days a week from 6 a.m.-1 a.m. EST. You can also check out our Community and Support pages at htc.com/us and our pages on Facebook and Twitter.
Click to expand...
Click to collapse
I contacted HTC about this issue with my incredible and I basically got the same answer except the guy was more knowledgeable and said that other people were complaining about certain bluetooth issues. I think they know what they did and are waiting to fix it in Froyo to be easy for them. No worries though, should be comin' in a few weeks. I can't freakin' wait. I have soooooooooo much Pokemon and Mario to play.
does anyone know if this works on samsung galaxy s, i dont have my phone yet to test, but as soon as it arrives (sometime next week) i will test this.
All I can say is that my wii controller is working really well on cyanogen on my evolution now!

[Q] Using android as a HID device

I'm currently writing an app that requires my phone to be detected by another device as a HID keyboard via bluetooth. I'm finding ALOT of info on connecting HID devices to the phone, but I'm trying to do the opposite. Connect my phone as a HID device to something else, for example, use my phone's keyboard on another device which doesn't have it's own keyboard.
An example of this would be bluemaemo: http://www.valeriovalerio.org/?page_id=174
That's only for select nokia phone's though. Is there anything like this or is it possible to implement this functionality somehow?
Also I'm using the Galaxy S I9000, just in case that has different limitations that stock android builds.
I'm still sort of new to developing so excuse my ignorance.

Using a phone as input device

I know you are able to use it as mouse or keyboard replacement for a PC (I assume this covers Mac as well), but how about another Android device?
Here is the thing, I bought an Android-on-a-stick device. You plug it into your TV's HDMI port and have ICS on the screen. Off course, this device doesn't come with any input options, but relies on USB, BT or WiFi for input. Since I have a HTC Desire that I no longer use except as music player, I thought it would be nice if I could incorporate something like GRemote but for another Android device, I suppose primary setup has to through USB, but after that it would be so much easier to use the screen of the Desire. Has anyone accomplished something like this, or are someone working on it and in need of Beta testers?

[Q] any app to control tablet from phone?

Blueputdroid was awesome to use as a witless mouse keypad and game controller so I could hook my tablet to my TV and use my phone to control it. But Google changed the Bluetooth stack in 4.2 and maybe 4.1 so this app no longer works. Tried to contact the dev for weeks but no response. I've tried various others but no luck. Anyone have a way? I asked cm devs about it and they said there is no way for them to revert or change the Bluetooth stack. I'm running cm10.1 BTW. Thanks

Bluetooth question

Hi guys, I really hope someone here knows the answer to this (even if it is to say it's not possible). I recently got an Android head unit and am having a couple of issues. It shows as an audio device when I pair up my phone and there is no way to connect it to anything else such as my obd2 device. I have searched for an answer but really don't know how to frame the search. Is there any way to reprogram the device so I have full bluetooth access to pair it up to other devices.
I do have another issue where I cannot connect to it through the USB from my laptop so cannot use adb to try and root the device. It appears to "see" usb memory sticks fine but nothing else..
If anyone has any suggestions on where to look (and I have looked) I would be grateful.
Thanks

Categories

Resources