Samsung Galaxy bluetooth drivers

2019-02-03 20:56发布

问题:

I have written an application for Android. the main part being that it communicates via bluetooth. I have four devices:
1. Samsung Galaxy S2
2. Samsung Galaxy Gio
3. Netsurfer touch (A REALLY low end locally [South Africa] produced android tablet)
4. A Motorolla ET1

Now I have written my app - I need to test the complete structure.

I first wrote the bluetooth side (since that was what I had the least experience in) - and the only device I can get to work is the Netsurfer touch. It uses standard bluetooth drivers and it works PERFECTLY - I can receive the signal on the PC and deal with it perfectly well.

The OTHER part of my app, cannot be done on the Netsurfer because it is too low spec (it actually doesn't have the required hardware). I have tried the Motorlla and the entire app works as expected.

But now the Galaxy phones (both Gio and S2) refuse to connect with any computers. They will PAIR fine, but when I use the bluetooth code to connect I just get an IOException: Service discovery failed

Since it is not my code, I started looking an there is a driver missing on my computer: "Bluetooth peripheral Device" - the error code The drivers for this device are not installed. (Code 28)

I have tried using Windows update, and that fails, I have Samsung Kies installed, AND I have verified the problem on two separate computers - both running Windows 7 x64

The hardware id's are:
BTHENUM{00001132-0000-1000-8000-00805f9b34fb}_VID&0001000f_PID&0000
BTHENUM{00001132-0000-1000-8000-00805f9b34fb}_LOCALMFG&000f

I do not believe there to be a problem with the code, but with the drivers of the devices. But if you need code, I am using the code found here: http://code.google.com/p/backport-android-bluetooth/source/browse/trunk/backport-android-bluetooth201/src/backport/android/bluetooth/chat/?r=49

回答1:

In my app i have bluetooth, working on stock galaxy S (both 1 and 2), Nexus One, HTC Desire, asus tablet and some other device. My app is from android 2.1, and i have this reflaction in my code (with the SDK, it somtimes failed for uknown reason to me, with the "Service discovery failed" error message) that fixed the error:

BluetoothSocket mSocket = null;
mBluetoothAdapter.cancelDiscovery();

Method method;
try {
            method = mBluetoothDevice.getClass().getMethod("createRfcommSocket", new Class[] {int.class});
            mSocket = (BluetoothSocket) method.invoke(mBluetoothDevice,1);
    } catch (NoSuchMethodException e1) {
            e1.printStackTrace();
    } catch (IllegalArgumentException e) {
            e.printStackTrace();
    } catch (IllegalAccessException e) {
            e.printStackTrace();
    } catch (InvocationTargetException e) {
            e.printStackTrace();
    }

mSocket.connect();

but other then that, i use the sdk, and everything works.



回答2:

The problem is, that newer Samsung devices (and HTC sense devices) don't have the full Bluetooth stack.

That is why for example apps like this one don't work on these devices either. The only solution would be to flash a full Bluetooth stack, eg by flashing a Cyanogenmod Rom.