Bluetooth-Manager-for-Glass icon indicating copy to clipboard operation
Bluetooth-Manager-for-Glass copied to clipboard

Support for connecting to devices which require a PIN?

Open Splaktar opened this issue 11 years ago • 8 comments

I'm attempting to connect to an ODBII device for use with the Voidstar-AutoHud app, but so far I'm not able to pair with the ODBII device. It shows up and I tell it to pair, then I get a pairing confirmation dialog with a passkey of something like '-24938379', which I then confirm. But then there is a long pause and nothing happens. Repeated attempts don't yield a better result.

From what I can tell, since the ODBII device has no screen, it requires a passkey like 0000 or 1234 in order to pair.

This message appears to be an issue: Unsupported Bluetooth pairing variant: 0

Here is the rest of my logcat:

I/ActivityManager(  189): START {cmp=com.recursivepenguin.bluetoothmanagerforglass/.PairDevicesActivity} from pid 4961
V/bluez   (  764): external/bluetooth/bluez/plugins/hciops.c:hciops_start_inquiry() hci0 length 8
E/bluez   (  764): Discovery session 0x1f08f20 with :1.0 activated
V/bluez   (  764): external/bluetooth/bluez/src/adapter.c:session_ref() 0x1f08f20: ref=1
V/bluez   (  764): external/bluetooth/bluez/plugins/hciops.c:set_state() hci0: new state 1
V/bluez   (  764): external/bluetooth/bluez/src/adapter.c:adapter_set_state() hci0: new state 1
D/BluetoothEventLoop(  189): Property Changed: Discovering : true
D/CardScrollView( 4961): Activating.
I/ActivityManager(  189): Displayed com.recursivepenguin.bluetoothmanagerforglass/.PairDevicesActivity: +226ms
D/OpenGLRenderer( 4961): Flushing caches (mode 0)
D/BluetoothService(  189): updateDeviceServiceChannelCache(11:22:33:AA:BB:CC)
D/SliderMenuPresenter( 4961): Initialize a new menu view : 1
D/CardScrollView( 4961): Activating.
D/SliderSubMenuProvider( 4961): Open top-level menu
D/audio_hw_primary(  109): select_output_device: output_type: 1, base_headset_volume: 1
W/Resources(  189): Converting to boolean: TypedValue{t=0x3/d=0xc4b "res/anim/accelerate_interpolator.xml" a=1 r=0x10a0005}
V/bluez   (  764): external/bluetooth/bluez/src/adapter.c:session_unref() 0x1f08f20: ref=0
V/bluez   (  764): external/bluetooth/bluez/src/adapter.c:session_remove() Discovery session 0x1f08f20 with :1.0 deactivated
V/bluez   (  764): external/bluetooth/bluez/src/adapter.c:session_remove() Stopping discovery
V/bluez   (  764): external/bluetooth/bluez/plugins/hciops.c:hciops_stop_discovery() index 0
V/bluez   (  764): external/bluetooth/bluez/plugins/hciops.c:hciops_stop_inquiry() hci0
E/bluez   (  764): Stopping discovery
V/bluez   (  764): external/bluetooth/bluez/plugins/hciops.c:set_state() hci0: new state 0
V/bluez   (  764): external/bluetooth/bluez/src/adapter.c:adapter_set_state() hci0: new state 0
D/BluetoothEventLoop(  189): Property Changed: Discovering : false
D/BluetoothBondState(  189): setBondState address: 11:22:33:AA:BB:CC state: 11reason: 0
E/BluetoothHeadset(  189): Could not bind to Bluetooth Headset Service
E/BluetoothBondState(  189): Proxy is null:android.bluetooth.BluetoothA2dp@418339c0:null
D/BluetoothBondState(  189): 11:22:33:AA:BB:CC bond state 10 -> 11 (0)
D/SliderMenuView( 4961): Performed action on 0 : true
W/ActivityManager(  189): Unable to start service Intent { act=android.bluetooth.IBluetoothHeadset }: not found
V/bluez   (  764): external/bluetooth/bluez/src/adapter.c:adapter_create_device() 11:22:33:AA:BB:CC
V/bluez   (  764): external/bluetooth/bluez/src/device.c:device_create() Creating device /org/bluez/764/hci0/dev_11_22_33_AA_BB_CC
V/bluez   (  764): external/bluetooth/bluez/src/device.c:btd_device_ref() 0x1ef5f60: ref=1
V/bluez   (  764): external/bluetooth/bluez/src/device.c:device_set_temporary() temporary 1
V/bluez   (  764): external/bluetooth/bluez/src/device.c:bonding_request_new() Requesting bonding for 11:22:33:AA:BB:CC
V/bluez   (  764): external/bluetooth/bluez/src/device.c:bonding_request_new() Temporary agent registered for 11:22:33:AA:BB:CC at :1.0:/android/bluetooth/remote_device_agent
E/BluetoothService.cpp(  189): stopDiscoveryNative: D-Bus error in StopDiscovery: org.bluez.Error.Failed (Invalid discovery session)
D/BluetoothEventLoop(  189): Property Changed: Devices : 2
I/PairingPolicy/pairingReceiver(  355): ACTION_BOND_STATE_CHANGED: OBDII @ [11:22:33:AA:BB:CC] BONDING
W/Resources(  189): Converting to boolean: TypedValue{t=0x3/d=0xc4c "res/anim/decelerate_interpolator.xml" a=1 r=0x10a0006}
V/bluez   (  764): external/bluetooth/bluez/plugins/hciops.c:conn_complete() status 0x00
V/bluez   (  764): external/bluetooth/bluez/src/adapter.c:adapter_get_device() 11:22:33:AA:BB:CC
D/BluetoothEventLoop(  189): Device property changed: 11:22:33:AA:BB:CC property: Connected value: true
V/bluez   (  764): external/bluetooth/bluez/plugins/hciops.c:remote_features_information() hci0 status 0
V/bluez   (  764): external/bluetooth/bluez/plugins/hciops.c:remote_name_information() hci0 status 0
V/bluez   (  764): external/bluetooth/bluez/plugins/hciops.c:link_key_request() hci0 dba 11:22:33:AA:BB:CC
V/bluez   (  764): external/bluetooth/bluez/plugins/hciops.c:get_auth_info() hci0 dba 11:22:33:AA:BB:CC
V/bluez   (  764): external/bluetooth/bluez/plugins/hciops.c:link_key_request() kernel auth requirements = 0x03
V/bluez   (  764): external/bluetooth/bluez/plugins/hciops.c:link_key_request() Matching key not found
V/bluez   (  764): external/bluetooth/bluez/plugins/hciops.c:pin_code_request() hci0 PIN request for 11:22:33:AA:BB:CC
V/bluez   (  764): external/bluetooth/bluez/src/adapter.c:adapter_get_device() 11:22:33:AA:BB:CC
V/bluez   (  764): external/bluetooth/bluez/src/device.c:device_request_authentication() Requesting agent authentication for 11:22:33:AA:BB:CC
I/BluetoothEventLoop.cpp(  189): agent_event_filter: Received method org.bluez.Agent:RequestPinCode
D/BluetoothBondState(  189): setBondState address: 11:22:33:AA:BB:CC state: 11reason: 0
I/ActivityManager(  189): START {act=android.bluetooth.device.action.PAIRING_REQUEST flg=0x10000000 cmp=com.google.glass.bluetooth/.pairing.BluetoothPairingConfirmationActivity (has extras)} from pid 355
I/BluetoothPairingConfirmationActivity(  355): onCreate(null, 41794d08):
D/OpenGLRenderer( 4961): Flushing caches (mode 1)
I/BluetoothPairingConfirmationActivity(  355): onStart: 41794d08
I/BluetoothPairingConfirmationActivity(  355): onResume: 41794d08
D/OpenGLRenderer( 4961): Flushing caches (mode 0)
W/InputManagerService(  189): Starting input on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy@4189dbe0 (uid=10035 pid=4961)
I/ActivityManager(  189): Displayed com.google.glass.bluetooth/.pairing.BluetoothPairingConfirmationActivity: +411ms
W/BluetoothPairingConfirmationActivity(  355): Unsupported Bluetooth pairing variant: 0
D/audio_hw_primary(  109): select_output_device: output_type: 1, base_headset_volume: 1
I/BluetoothPairingConfirmationActivity(  355): onPause: 41794d08
D/OpenGLRenderer(  355): Flushing caches (mode 0)
D/OpenGLRenderer(  355): Flushing caches (mode 1)
I/BluetoothPairingConfirmationActivity(  355): onStop: 41794d08
I/BluetoothPairingConfirmationActivity(  355): onDestroy: 41794d08

Thanks for creating this. The other alternative appears to be using the Settings.apk and buying a Bluetooth keyboard in order to enter the PIN code. This is suggested here (https://github.com/ZackFreedman/Voidstar-AutoHud).

Splaktar avatar Jan 27 '14 00:01 Splaktar

Right now this app requires you to pair a bluetooth keyboard in order to enter the pin to pair devices like the ODBII bridge.

DDRBoxman avatar Jan 27 '14 00:01 DDRBoxman

I am having the same problem as noted above, connecting Glass to the IOIOMint board. The problem is, where do I enter the PIN to connect with my device? All it says is PAIR and then it shows me the Pair confirmation dialog "Tap if displaying -21474883648"

kotasampei avatar Feb 20 '14 20:02 kotasampei

Any news on this one?

jamona avatar Jan 21 '15 13:01 jamona

Along the lines of #6 don't expect any of this to work ever now that Google is no longer fixing bugs on Glass.

DDRBoxman avatar Jan 21 '15 16:01 DDRBoxman

Do you have any other ideas how I can connect a micro controller (Arduino) to a Google Glass and sending messages from Glass to Arduino? I'm stuck with this bluetooth stuff...

jamona avatar Jan 21 '15 21:01 jamona

So I think the bluetooth LE APIs work correctly so you could use something like this: http://www.adafruit.com/product/1697

They also added usb host mode at some point. There are Android libraries that talk to Arduino over a USB OTG cable.

DDRBoxman avatar Jan 21 '15 21:01 DDRBoxman

Thanks a lot! Do you have experience with the Bluefruit LE (especially regarding if a PIN is needed as well as hacking with the settings.apk)?

jamona avatar Jan 21 '15 21:01 jamona

Bluetooth LE devices don't need to be paired through settings. Any app can discover and connect to a LE device without system level permissions.

The nice thing about the Adafriut breakout is that you can use the Nordic libraries and utilities for the NRF8001 to define custom services and characteristics and make it a true LE device. Or you can use the serial emulation protocol that they provide.

DDRBoxman avatar Jan 21 '15 21:01 DDRBoxman