kirosrdz / android-bluez-ime

Automatically exported from code.google.com/p/android-bluez-ime
0 stars 0 forks source link

Support the Wii-mote #7

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
If possible, the Wii-mote should be supported as well.

Original issue reported on code.google.com by kenneth@hexad.dk on 30 Jan 2011 at 9:37

GoogleCodeExporter commented 8 years ago
"this does invalidate your phone warranty by the way" it's like pretending that 
HP or Sony would refuse to repair my PC because they caught me logged as admin. 
AHAH

Original comment by paolo.ru...@gmail.com on 23 Nov 2011 at 11:15

GoogleCodeExporter commented 8 years ago
I cant get this to work with the evo is there something im doing wrong? Ive 
tried all the downloads has anyone with the htc evo got this working yet and 
can tell me how they did it?

Original comment by dirkab...@hotmail.com on 25 Nov 2011 at 5:32

GoogleCodeExporter commented 8 years ago
On the issue above i forgot to mention that i got error code 0 i think and also 
the wiimote shows up in blue tooth devices i just cant get it to connect

Original comment by dirkab...@gmail.com on 25 Nov 2011 at 6:28

GoogleCodeExporter commented 8 years ago
If you are running withthe Sense ROM, it does not work. HTC only supports a 
limited number of Bluetooth addons, and they have removed the unsupported 
kernel code from Android. In other words: unless you flash your phone with a 
custom ROM, it will not work.

Original comment by kenneth@hexad.dk on 26 Nov 2011 at 11:12

GoogleCodeExporter commented 8 years ago
Issue 72 has been merged into this issue.

Original comment by kenneth@hexad.dk on 15 Dec 2011 at 2:50

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I just noticed something.
I wanted to try to connect a game controller to my Galaxy S2. Since it seems 
like it can't handle a Wiimote without giving up the advantages of Touchwiz 
(Smart View, Allshare, ...), I checked the SixAxis app. I bought it and I 
returned it a little later, because I noticed I was able to pair and use 
Wiimotes in SNES 9x EX. Unfortunately it seems like this pairing only worked 
because I had the SixAxis app installed and active. After uninstalling it the 
Wiimote didn't work. If I'd only checked it before I had the app active, I'd 
have some proof that it was due to the app. If someone who owns the SixAxis app 
could check if he can pair WiiMotes while the SixAxis app is active... I'd 
proof that they found a way to add L2CAP.

Original comment by Upi...@gmail.com on 22 Jan 2012 at 9:06

GoogleCodeExporter commented 8 years ago
The Sixaxis app uses root to do some magic.
With root access it is possible to use a custom bluetooth library talking 
directly to the bluetooth chip.
I do not have the time to take on the effort of reproducing that, but I am most 
certainly accepting contributions.

Original comment by kenneth@hexad.dk on 24 Jan 2012 at 7:36

GoogleCodeExporter commented 8 years ago
My Samsung captivate  just got upgraded to gingerbread. is that a game-changer 
or am i still out of luck?

Original comment by beingjac...@gmail.com on 3 Feb 2012 at 11:23

GoogleCodeExporter commented 8 years ago
i attempted this, got the unknown error, i have samsung captivate glide, not 
listed as a galaxy S but may be one

Original comment by adam.cap...@gmail.com on 4 Feb 2012 at 5:13

GoogleCodeExporter commented 8 years ago
There is really no way of knowing, you just have to try it to see.
The device makers usually do not make a public declaration with what kernel 
features they include.
If you get "Unknown error: 0", then the kernel is still missing the required 
L2CAP.

Original comment by kenneth@hexad.dk on 15 Feb 2012 at 9:40

GoogleCodeExporter commented 8 years ago
I have a Galaxy S2 and I can confirm that while Sixaxis is running in the 
background the integrated wiimote functions of GBC.emu and SNES 9x EX do work 
perfectly. Can only assume that Sixaxis does something under the hood that 
makes it work. To confirm, I'm running a rooted GS2 with stock Rom.

Original comment by rexxcali...@gmail.com on 18 Feb 2012 at 3:48

GoogleCodeExporter commented 8 years ago
In response to comment #112: is your Galaxy S2 rooted? I have a Galaxy Note 
which is not rooted, and the Sixaxis notes in Market says it only works on 
rooted phones. But from what I read here, it sounds possible that installing 
the Sixaxis app on my non-rooted phone may indeed overcome the L2DAP issue so I 
can use a wiimote. Any thoughts?

Original comment by j...@tbplan.com on 18 Feb 2012 at 7:06

GoogleCodeExporter commented 8 years ago
I have been in touch with the Sixaxis app dev, and yes, it basically loads 
another bluetooth library onto your phone while running. It has some drawbacks, 
but it should work with any rom, as long as it is rooted. (And yes, you need 
root, installing a custom bluetooth library is not something an ordinary app 
should be allowed to do).

I have asked him to make the function available in a paid app, so you could pay 
(say 1$ or whatever), and Bluez IME would then activate the library before 
connecting, essentially giving Wiimote support to TouchWiz and Sense based 
ROMs. But until he either makes the library, or someone else does, you may be 
able to trick it by using the Sixaxis app.

Original comment by kenneth@hexad.dk on 20 Feb 2012 at 9:02

GoogleCodeExporter commented 8 years ago
In response to comment 113, yes, my Galaxy S2 is rooted. And in response to 
comment 114, that sounds pretty awesome. Loving using the wiimote with the SNES 
and GBC emulators (and an MHL adaptor) but I'd love to be able to use it with 
the N64 emulator too! Never thought I'd be able to play classics like Super 
Mario World and Mario Kart in 52 inch HD glory!

Original comment by rexxcali...@gmail.com on 20 Feb 2012 at 6:42

GoogleCodeExporter commented 8 years ago
Issue 156 has been merged into this issue.

Original comment by kenneth@hexad.dk on 3 Apr 2012 at 9:29

GoogleCodeExporter commented 8 years ago
@kenneth: Unfortunately it's impossible to use the SixAxis app (I have bought 
it for this very reason) to have my Wiimote recognized by Bluezime. 

The reason is that every time I try to use the "Bluez IME" it tries to enable 
bluetooth which simply freezes my SGS and makes it unable either to recognize 
my Wiimote OR my sixaxis. Is there any way to enable the SixAxis' library in 
such a way that it would not interfere with the Bluez IME?

Original comment by Stefanos...@gmail.com on 9 Apr 2012 at 1:26

GoogleCodeExporter commented 8 years ago
@Stefanos187:
There is a setting in the bottom of BluezIME called "Manage Bluetooth". If you 
remove the check mark from that box, Bluez IME should not try to turn Bluetooth 
on or off.

Original comment by kenneth@hexad.dk on 10 Apr 2012 at 11:34

GoogleCodeExporter commented 8 years ago
@Kenneth: If I do that choosing bluez ime simply shows "error: bluetooth is 
currently off" ... it *needs* the stock bluetooth library to be on, if not for 
that it simply refuses to connect to my wiimote (even though it is able to). 
I'm at loss at how you guys managed to connect your wiimote via the "sixaxis 
method"... Anyhow thanks for this great app.

Original comment by Stefanos...@gmail.com on 11 Apr 2012 at 3:37

GoogleCodeExporter commented 8 years ago
Hi there! Me again! I updated my Galaxy S II to Ice Cream Sandwich a few weeks 
ago and have since lost functionality of the Wii remote with the phone. I've 
noticed that  the Sixaxis app now responds differently when it is started. It 
now uses 'method 1' to connect whereas previously it had to use 'method 2'. I 
have no idea what has changed in the ICS update but it seems the Sixaxis 
binaries no longer load in the same way and they no longer replace the Samsung 
ones in the way that they did...

Original comment by rexxcali...@gmail.com on 11 Apr 2012 at 6:18

GoogleCodeExporter commented 8 years ago
Hi, I have a Le Pan II running 3.2.1 Honeycomb.  When I use my wii classic 
controller in n64oid, the control sticks don't seem to be properly calibrated.  
In Ocarina of Time, Link twirls around in a circle and can only run backwards.  
Any suggestions?  my email is sclebow@gmail.com

Original comment by SCLe...@gmail.com on 13 Apr 2012 at 10:26

GoogleCodeExporter commented 8 years ago
@Stefanos187, @rexxcalibur: I have not tried the sixaxis app, so I cannot help 
you there. I have attached a version where the checks to see if Bluetooth is on 
have been disabled, so it will try to connect even if Bluetooth is off.

@SCLebow: See issue #127:
http://code.google.com/p/android-bluez-ime/issues/detail?id=127

Original comment by kenneth@hexad.dk on 14 Apr 2012 at 9:34

GoogleCodeExporter commented 8 years ago
Sorry, wrong build (Eclipse did not save my changes when exporting).
Updated build attached.

Original comment by kenneth@hexad.dk on 14 Apr 2012 at 10:19

Attachments:

GoogleCodeExporter commented 8 years ago
Hi there Kenneth. Thanks for the upload, but I'm afraid it's of the version 
that does not inlude the Wiimote drivers (I think 1.14+Wiimore is the latest 
one). 

Anyhow, even if you were to upload that version I'm afraid it wouldn't work 
either and unless someone of those who actually did make it work (via the 
sixaxis library) get online and tell us how, we're in the dark.

Again ... thanks for your efforts :)

Original comment by Stefanos...@gmail.com on 15 Apr 2012 at 7:23

GoogleCodeExporter commented 8 years ago
I changed how it works, so you need to install the HIDEnabler.apk package to 
get HID (and thus Wiimote) support. This allows me to upload a single .apk to 
market and on this site, and those who understand how to install the 
HIDEnabler.apk hopefully understand that it may not work on their ROM. Latest 
version is 1.16.

http://code.google.com/p/android-bluez-ime/downloads/detail?name=BluezIME-HIDEna
bler.apk

Original comment by kenneth@hexad.dk on 15 Apr 2012 at 7:59

GoogleCodeExporter commented 8 years ago
Kenneth unfortunately I get the same error 0 :( ... as I was afraid, I would be 
glad to see how those guys who purport that they made it work through the 
sixaxis library did it....

Original comment by Stefanos...@gmail.com on 16 Apr 2012 at 11:52

GoogleCodeExporter commented 8 years ago
Hi, can you help me? I bouth a samsung galaxy duos s6102, and i instal 
Blue\ime, but a can´t do this work yet. is this compatilbe? someone can help? 
Thanks. Sorry my english.

Original comment by lucianob...@hotmail.com on 25 Jun 2012 at 12:45

GoogleCodeExporter commented 8 years ago
Hi! I have a Galaxy S3 and i get the wiiremote + wii classic controller to work 
through "wiimoteController". I can play some snesgames and so on.. But when i 
try to use it with N64oid i says i need Bluez IME, so i tried to download it, 
with the HID enabler. But when im going to select BluezIME as the input method, 
i get "Error: null" and the wiimote stops blinking.

Original comment by jon...@gmail.com on 30 Jun 2012 at 4:26

GoogleCodeExporter commented 8 years ago
Are you refering to this: 
https://play.google.com/store/apps/details?id=com.ccpcreations.android.WiiUseAnd
roid ?
Are you using a rooted or custom ROM?

Original comment by kenneth@hexad.dk on 2 Jul 2012 at 8:52

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Tried 1.6,1.7 and the latest 1.14/1.16, and they all works with my Huawei 
C8812, but with a small problem: the LEDs on wiimote keep blinking. Any way to 
debug/fix it? Thanks

Original comment by slowa...@gmail.com on 14 Jul 2012 at 7:17

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Kenneth, I'm experiencing the same error as jon on a Galaxy S3, on . I get the 
messages "Connecting to <Wiimote's MAC>..." followed by "Error: null". This was 
the same on the 1.14-Wii version and the 1.17 Market version under the "Wii 
(HID)" device option. I'm rooted, on a stock Verizon rom (stock kernel). I have 
also successfully used the "Wiimote Controller" app (yes, the same one you 
linked) on the phone (and played games, not just paired). Attached is a logcat 
that should help.
It looks like
"E/BluetoothService.cpp(  498): stopDiscoveryNative: D-Bus error in 
StopDiscovery: org.bluez.Error.Failed (Invalid discovery session)"
and
"
D/RfcommReader - wiimote(10027): Failed to connect to E0:E7:51:F6:E4:50, 
message: java.lang.NullPointerException
E/RfcommReader - wiimote(10027): java.lang.NullPointerException"
would be a relevant starting point. Thanks.

Original comment by lazarus2...@gmail.com on 15 Jul 2012 at 6:20

Attachments:

GoogleCodeExporter commented 8 years ago
Attached is a version that has three changes:
1) The "Cancel Bluetooth Discovery" method is now guarded against errors.
2) There is more extensive debug info in the connect methods
3) General debug information is printed from the Rfcomm, HIDReaderBase and 
Wiimote classes

Please try this version and see if Logcat reports more usefull info. 

Original comment by kenneth@hexad.dk on 16 Jul 2012 at 8:39

GoogleCodeExporter commented 8 years ago
Sorry, broke the build, this is the correct version

Original comment by kenneth@hexad.dk on 16 Jul 2012 at 8:44

Attachments:

GoogleCodeExporter commented 8 years ago
Hello,
Thank you for your hard work making this app work for wiimotes . And in 
particular getting out to work for the Samsung phones. I wanted to let you know 
that i have just upgraded to ice cream sandwich on my galaxy s2 and you app now 
works splendidly.
Thank you

Original comment by devanneu...@gmail.com on 16 Jul 2012 at 12:39

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
If I press 1+2 on the WiiMote before activating the bluez-ime, the pairing 
notification shows up and disappears seconds later, but it stucks at 
"Connecting to xxx..." (see log1)
Then I switch back to the default IME, and switch to bluez-ime again, it stucks 
at "Turning bluetooth on..." and I can't get it work again anymore unless I 
kill the whole process. (see log2&3)

Original comment by slowa...@gmail.com on 18 Jul 2012 at 1:30

Attachments:

GoogleCodeExporter commented 8 years ago
    @Override
    protected void verifyHIDDevice() throws Exception {
        //When this is called, we are connected, 
        // so we set up the current state

        try{
            Thread.sleep(300);
        }catch(Exception e){
        }

        //Set the LEDs to indicate we are now connected
        setLEDs(true, false, false, false);

        //Set the report mode
        updateReportMode();

        //Request a status report so we detect extensions immediately
        requestStatus();
    }
Try to add 300ms delay before setting the LEDs, and the endless blinking 
problem is gone. Maybe it's better to move the delay and setLEDs after 
requestStatus()?

Original comment by slowa...@gmail.com on 19 Jul 2012 at 9:29

GoogleCodeExporter commented 8 years ago
For my previous problem, it seems that if wiimote is turned on before 
activating the bluez-ime, it stucks at m_controlSocket.connect(). And then 
switch the ime back to the default one and switch to the bluez-ime again, 
BluezService::onHandleIntent() won't be triggered again (as it's still 
processing the previous Intent?), so it stucks at "Turning bluetooth on..."

Original comment by slowa...@gmail.com on 19 Jul 2012 at 5:09

GoogleCodeExporter commented 8 years ago
change useInsecureChannel from false to true
protected boolean m_useInsecureChannel = true;
My connection problem is gone, and it connects to my wiimote pretty fast now. 
Will you provide a switch in the preference for this?

Original comment by slowa...@gmail.com on 21 Jul 2012 at 6:29

GoogleCodeExporter commented 8 years ago
Hi slowargo, great debugging!

I could not find anything in your logs, but since you have found the problem, I 
don't need them.

For the LED issue, instead of the delay, can you try to call setLEDs twice?
I have comitted a fix where there is a sleep(500) call here.
I am not sure what will happen if you move stuff around, I am worried that 
another call will then be ignored then, which is harder to debug than the 
blinking LEDs.

I really don't like settings, I have changed the code to always use insecure. I 
think someone eavesdropping on your Wiimote keypresses is not really a security 
concern :)

Attached is a new build with those changes. If I hear no complaints, I will 
publish that one as the new version.

Original comment by kenneth@hexad.dk on 21 Jul 2012 at 11:19

Attachments:

GoogleCodeExporter commented 8 years ago
Thanks for the new build!
Just had a try. Most of the time it works better than the previous versions. 
But sometimes I get "software caused connection abort"
And for the suggestion on the LED issue, calling setLEDs twice doesn't help :( 
Actually the delay trick doesn't always work either especially when the wiimote 
is turned on before bluez-ime starts the bluetooth service. And my final 
workaround is adding an ugly hack that calling setLEDs when + & - buttons are 
pressed simultaneously... 

Original comment by slowa...@gmail.com on 23 Jul 2012 at 2:56

GoogleCodeExporter commented 8 years ago
I got it. The exception is caused by the following code block:
        if (!m_useInsecureChannel) {
            try {
                m_controlSocket = device.createLCAPSocket(HIDP_CONTROL_CHANNEL);
                m_controlSocket.connect();
                isSecure = true;
            } catch (Exception ex) {
                m_controlSocket = null;
            }
        }

        if (m_controlSocket == null) {
            m_controlSocket = device.createInsecureLCAPSocket(HIDP_CONTROL_CHANNEL);
            m_controlSocket.connect();
        }
When m_useInsecureChannel = true, the first assignment of m_controlSocket is 
always bypassed. If wiimote is connected during the first try, everything is 
OK. But if it's not connected and the above code is hit in the next try, 
m_controlSocket keeps its value which is assigned in the first try but the 
socket is unconnected, and as a result the controlsocket won't be connected 
again. My quick fix is always try to close the socket before. Just for ur 
reference 

@@ -50,6 +50,29 @@

        boolean isSecure = false;

+       if (D) Log.d(LOG_NAME, "Connecting " + m_address);
+       Log.d(LOG_NAME, "Before " + m_controlSocket);
+
+       if (m_controlSocket != null) {
+           try {
+               m_controlSocket.close();
+               m_controlSocket = null;
+           }catch (Exception ex) {
+               m_controlSocket = null;
+           }
+       }
+       
+       if (m_socket != null)
+       {
+           try {
+               m_socket.close();
+               m_socket = null;
+           }catch (Exception ex) {
+               m_socket = null;
+           }
+       }
+
+       
        if (!m_useInsecureChannel) {
            try {
                m_controlSocket = device.createLCAPSocket(HIDP_CONTROL_CHANNEL);

Original comment by slowa...@gmail.com on 23 Jul 2012 at 3:52

GoogleCodeExporter commented 8 years ago
Did some more tests on the LED issue. If I comment out updateReportMode(); and 
requestStatus(); in verifyHIDDevice(), LEDs status can be set correctly. So 
that could not be a bluetooth issue. Then I try to put a 300ms delay AFTER 
setLEDs, and strangely enough, it never fails anymore! So I can happily remove 
my ugly hack now...

Original comment by slowa...@gmail.com on 23 Jul 2012 at 9:45

GoogleCodeExporter commented 8 years ago
Hi all! Just wanted to add my experience with the latest version I tried 
yesterday:

I'm running 4.1.1 on galaxy nexus.

I couldn't find the wiimote in the devices list. Do I need to install any other 
thing besides BluezIME-v1.17-minSdk-8-WiimoteFixes.apk ?

Also, I still get a request for pin when using bluez. bluez went a little bit 
lost with this request and keep trying to sync and switched on my bluetooth 
frequently. Maybe I should not tick that option to manage bluetooth? :)

Another interesting thing is that when I had 4.0.2 on my galaxy nexus, I could 
use snesoid and pair it without any problem! even without using bluez. I think 
it is highly probably that 4.1.1 had a lot of changes to the bluetooth stack 
and now it is asking for a pin.  What could I insert as a pin? I already tried 
the reversed BT mac value of my cel with no luck. Do you guys have any other 
idea about what I could try?

Thanks in advance.

Original comment by francisc...@gmail.com on 24 Jul 2012 at 1:34

GoogleCodeExporter commented 8 years ago
Issue 177 has been merged into this issue.

Original comment by kenneth@hexad.dk on 9 Aug 2012 at 9:05

GoogleCodeExporter commented 8 years ago
Hi guys. I have a Samsung Captivate Glide. Do you know if it's possible to get 
a Wii remote working with it? I know it has the same problem of pairing because 
it doesn't support L2CAP but is there some way to get it working?

Original comment by RKn...@gmail.com on 26 Aug 2012 at 1:03

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Samsung galaxy S3 here, can't connect to wiimote, when i try to enter PIN, 
either 1234 or 0000 it either refreshes the enter PIN screen or says "too many 
symbolic links encountered" or "software caused connection abort" or "host is 
down" b/c the wiimote immediately turns off. Googled this for about an hour, 
tried everything suggested (downloading .apk versions here and not in play 
store) and still can't figure it out. really just want to play n64 with a 
wiimote :(

plz help, or at least tell me "you can't" b/c I can't find that answer anywhere 
either

Original comment by Bradfiel...@gmail.com on 28 Aug 2012 at 4:38