Re: Use android device as remote for the WII September 20, 2010 04:29PM | Registered: 13 years ago Posts: 28 |
Re: Use android device as remote for the WII September 20, 2010 04:31PM | Registered: 13 years ago Posts: 24 |
Re: Use android device as remote for the WII September 20, 2010 04:36PM | Admin Registered: 16 years ago Posts: 3,247 |
Re: Use android device as remote for the WII September 20, 2010 04:38PM | Registered: 13 years ago Posts: 24 |
Quote
GregQuote
rikmer
As far as I know you can change the DeviceID which consists of the VID and PID in the main.conf of the bluetooth settings under /system/etc/bluetooth .
Oh man, that would be horrible if you had to do that to make it work. It would kill any chances of your app being successful in the Android Market. Who would want to do that to their phone? Requiring root is bad enough...but needing to edit system config files...Quote
rikmer
Could you provide your experimental code?
Sure. I might not have a lot of time during the week, but I'll try to get to it.Quote
rikmer
I also managed to add the service but when I compare the wiimote services to the phone services ...
Service RecHandle: 0x0
Service Class ID List:
"SDP Server" (0x1000)
Protocol Descriptor List:
"L2CAP" (0x0100)
PSM: 1
"SDP" (0x0001)
Language Base Attr List:
code_ISO639: 0x656e
encoding: 0x6a
base_offset: 0x100
Profile Descriptor List:
"" (0x0100)
Version: 0x0100
... is missing.
I think this is just the entry for the SDP server. Can't imagine this block would be required by the Wii. Actually, this entry is there, you just have to ask for it specifically:sdptool get 0
When you queried the phone, were you doing so locally or from another device? Maybe when you're querying locally it doesn't show you the SDP server? But you will see it when querying from another device?
Another thing I didn't try, when I added the WIIMOTE service, it added it as 0x10007. Maybe I should have forced it to match the remote's handle for the same service.
And if that doesn't work, I'll remove all the other services 0x10001 - 0x10006. They show back up again after you turn off/on bluetooth.
Re: Use android device as remote for the WII September 21, 2010 04:40PM | Registered: 13 years ago Posts: 24 |
Re: Use android device as remote for the WII September 21, 2010 07:24PM | Registered: 13 years ago Posts: 28 |
Re: Use android device as remote for the WII September 21, 2010 07:48PM | Registered: 13 years ago Posts: 28 |
Re: Use android device as remote for the WII September 21, 2010 08:05PM | Registered: 13 years ago Posts: 24 |
Quote
Greg
How did you test it? Are you opening up an L2CAP server socket and waiting for an incoming connection?
Re: Use android device as remote for the WII September 21, 2010 08:09PM | Registered: 13 years ago Posts: 24 |
Quote
Greg
I had another setback last night. I was looking through the Android source code again to make sure I wasn't missing something and I found something pretty significant. Let me explain by backing up a bit.
The public Android API currently does not support L2CAP sockets, which is what is going to be required to pull this whole thing off. There is currently an open issue, [code.google.com], but it is not scheduled yet. However if you look at the source code you will see there is a private API with plenty of support for L2CAP.
So I wrote my own API that accesses this private API via reflection. It works great for connecting to other L2CAP devices. But when I try to open up a server socket to listen for incoming connections, I forgot to call a key method...bindListen(). Since I wasn't calling this method, my server sockets were never really listening to anything. So I put the call to bindListen() in last night and the return code I kept getting back was 13, which is the unix errno for "Permission Denied". If I use my same API for RFCOMM (which isn't practical since the public API already supports RFCOMM, but this was just to prove a point), the return code is 0 (success). So there is something about requesting to bind an L2CAP socket to the system, that is not allowed. I traced this down through the Android source code, even into the native C code. The support appears to be there at all levels. The problem is someting really low level is not allowing it. Perhaps something in bluez is disabling L2CAP?? But like I said...connecting to other L2CAP devices works fine.
Re: Use android device as remote for the WII September 21, 2010 08:57PM | Registered: 13 years ago Posts: 28 |
Quote
rikmer
Managed to change device class by using "hciconfig hci0 class 0x002504". A good thing is that this is reverted if you reboot the phone.
Quote
rikmer
Is there a way to open L2CAP without coding it
Quote
rikmer
One other interesting thing is that the pin for the wiimotes is the reversed mac address as stated here [wiibrew.org] under Bluetooth Communication. I never was asked for a pin when connecting to my phone.
Quote
rikmer
I remember another guy who programmed SleepTimer (available int the market) which was working perfectly under android 2.1 but then stopped to work under 2.2 because they changed some API so that it isnt possible to stop music from an app. He managed to gain back full functionality by using root access. Is it perhaps again possible to open up L2CAP sockets by using root tricks?
allow.l2cap.bind=0
Re: Use android device as remote for the WII September 21, 2010 11:41PM | Registered: 13 years ago Posts: 24 |
Re: Use android device as remote for the WII September 22, 2010 05:56PM | Registered: 13 years ago Posts: 28 |
Re: Use android device as remote for the WII September 23, 2010 03:24PM | Registered: 13 years ago Posts: 24 |
Re: Use android device as remote for the WII September 23, 2010 05:57PM | Registered: 13 years ago Posts: 28 |
Quote
rikmer
One question. When you tried to bind the L2CAP socket did you do it as root? As far as I understand you didnt ... or am I wrong. I think it is possible to grant the function which binds the socket su rights.
Re: Use android device as remote for the WII October 09, 2010 12:31PM | Registered: 13 years ago Posts: 24 |
Re: Use android device as remote for the WII October 11, 2010 03:46PM | Registered: 13 years ago Posts: 28 |
Re: Use android device as remote for the WII December 06, 2010 08:36PM | Registered: 13 years ago Posts: 28 |
Re: Use android device as remote for the WII December 07, 2010 04:42PM | Registered: 13 years ago Posts: 13 |
Re: Use android device as remote for the WII December 07, 2010 05:55PM | Registered: 13 years ago Posts: 28 |
Re: Use android device as remote for the WII December 07, 2010 08:35PM | Registered: 13 years ago Posts: 13 |
Yeah, because of this site I thought you need HID with android in the role of a device.Quote
Greg
WiiBrew has great documentation on the Wiimote bluetooth spec.