maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   MeeGo / Harmattan (https://talk.maemo.org/forumdisplay.php?f=45)
-   -   [N9] script to force connection to Bluetooth audio device? (https://talk.maemo.org/showthread.php?t=85563)

slarti 2012-07-18 08:57

[N9] script to force connection to Bluetooth audio device?
 
I bought a Belkin CarAudio Connect AUX with Bluetooth, and it works ok when it's connected to my N9. The connecting part is troublesome. You are supposed to press the button once and it should connect, but this doesn't work half the time. If I initiate the connection from the N9, it works every time. For some reason it won't connect automatically.

I have ProfileMatic set up to enable Bluetooth (among other things) once it sees the NFC tag on my car holder. This isn't much use if the phone won't connect automatically, too.

So, is there any way to start the connection process to a known device with a script from the N9?

slarti 2012-07-18 20:14

Re: [N9] script to force connection to Bluetooth audio device?
 
Anyone?

I'm not sure if there's something wrong with my phone because it doesn't like to automatically connect to a BH-111 headset, either...

chilango 2012-07-18 20:47

Re: [N9] script to force connection to Bluetooth audio device?
 
I have en Audio-System in a Mazda and here you can take automatic connection. With this option my N9 connects automatic. Obvios in the N9 Bluetooth configuration you have this activate also.

slarti 2012-07-18 21:10

Re: [N9] script to force connection to Bluetooth audio device?
 
Now that you mention it, I think I got it to automatically connect to my mom's Ford. Too bad my car doesn't have built in BT...

Is there any way to emulate pressing this button?
http://i.imgur.com/yVuuu.png

justadude 2012-07-19 12:52

Re: [N9] script to force connection to Bluetooth audio device?
 
Yes I also have an option to connect automatically on my Pioneer head unit. Works almost instantly when I get into my car and power up the stereo. Hope this helps.

slarti 2012-07-19 13:38

Re: [N9] script to force connection to Bluetooth audio device?
 
Quote:

Originally Posted by justadude (Post 1239751)
Yes I also have an option to connect automatically on my Pioneer head unit. Works almost instantly when I get into my car and power up the stereo. Hope this helps.

Sadly, no. The Belkin has no option to connect automatically and the button (on the Belkin) method isn't reliable. This is why I would like the N9 to initiate the connection.

ltz 2012-07-22 09:38

Re: [N9] script to force connection to Bluetooth audio device?
 
Quote:

Originally Posted by slarti (Post 1239446)
Now that you mention it, I think I got it to automatically connect to my mom's Ford. Too bad my car doesn't have built in BT...

Is there any way to emulate pressing this button?

hciconfig command might be useful. Not sure how to pair a device but I guess it can't be too hard.
Code:

hciconfig - HCI device configuration utility
Usage:
        hciconfig
        hciconfig [-a] hciX [command ...]
Commands:
        up                      Open and initialize HCI device
        down                    Close HCI device
        reset                  Reset HCI device
        rstat                  Reset statistic counters
        auth                    Enable Authentication
        noauth                  Disable Authentication
        encrypt                Enable Encryption
        noencrypt              Disable Encryption
        piscan                  Enable Page and Inquiry scan
        noscan                  Disable scan
        iscan                  Enable Inquiry scan
        pscan                  Enable Page scan
        ptype      [type]      Get/Set default packet type
        lm        [mode]      Get/Set default link mode
        lp        [policy]    Get/Set default link policy
        name      [name]      Get/Set local name
        class      [class]      Get/Set class of device
        voice      [voice]      Get/Set voice setting
        iac        [iac]        Get/Set inquiry access code
        inqtpl    [level]      Get/Set inquiry transmit power level
        inqmode    [mode]      Get/Set inquiry mode
        inqdata    [data]      Get/Set inquiry data
        inqtype    [type]      Get/Set inquiry scan type
        inqparms  [win:int]    Get/Set inquiry scan window and interval
        pageparms  [win:int]    Get/Set page scan window and interval
        pageto    [to]        Get/Set page timeout
        afhmode    [mode]      Get/Set AFH mode
        sspmode    [mode]      Get/Set Simple Pairing Mode
        aclmtu    <mtu:pkt>    Set ACL MTU and number of packets
        scomtu    <mtu:pkt>    Set SCO MTU and number of packets
        putkey    <bdaddr>    Store link key on the device
        delkey    <bdaddr>    Delete link key from the device
        oobdata                Display local OOB data
        commands                Display supported commands
        features                Display device features
        version                Display version information
        revision                Display revision information
        block      <bdaddr>    Add a device to the blacklist
        unblock    <bdaddr>    Remove a device from the blacklist
        lerandaddr <bdaddr>    Set LE Random Address
        leadv                  Enable LE advertising
        noleadv                Disable LE advertising
        lestates                Display the supported LE states

f.e. to turn bluetooth on, you just type
Code:

hciconfig hci0 up

EDIT: Seems like connection to the device can be established with
Code:

hcitool cc --role=m 01:02:03:04:05:06 (mac addr)

slarti 2012-07-23 11:00

Re: [N9] script to force connection to Bluetooth audio device?
 
Thanks, I didn't know such a tool existed.

However, I can't get it to connect with it.

Code:

hcitool dc <address for belkin>
disconnects the Belkin but the cc command just does nothing.

I'll have to experiment with other devices once I get a chance.


All times are GMT. The time now is 05:55.

vBulletin® Version 3.8.8