GithubHelp home page GithubHelp logo

yasuwoh / bluetoothctl-autoconnector Goto Github PK

View Code? Open in Web Editor NEW

This project forked from noraworld/bluetoothctl-autoconnector

0.0 0.0 0.0 43 KB

Connects all paired Bluetooth devices automatically on Linux

Shell 100.00%

bluetoothctl-autoconnector's Introduction

bluetoothctl-autoconnector

A tool for bluetoothctl to connect all/any devices automatically.

Standalone

bluetoothctl attempts to connect all paired Bluetooth devices only once.

$ ./autoconnector.sh

It can also attempt to connect only specific devices.

$ ./autoconnector.sh -f <MAPPING_LIST_FILE>

For details on how to write a mapping list file, see list.sample.

Use ./autoconnector.sh -h for more information.

Register crontab

$ ./setup.sh

crontab will execute autoconnector.sh every minute. This will reconnect paired Bluetooth devices automatically even if they disconnect from a computer, and keep connecting them.

Motivation for making this tool

I’m using this tool on Ubuntu on Raspberry Pi, and I’m using my Raspberry Pi as Bluetooth audio receiver and mixer.

I always put in my Bluetooth headphone even though I don’t listen anything. Sometimes I’m listening something on iPhone and at other times I’m listening something on MacBook or TV.

I strongly think it’s hassle to switch Bluetooth connections every time I change the devices playing sounds. Then I came up with a good idea.

I connect all devices that play sounds with Raspberry Pi as audio profile (A2DP) instead of my Bluetooth headphone, mix up the sounds on Raspberry Pi, and transmit them to my Bluetooth headphone. And then, yay! Congratulations! I can now listen to sounds played on iPhone, MacBook and TV at the same time without switching Bluetooth connections.

This system is awesome for me, but the devices that play sounds are not always connecting with Raspberry Pi. I take my iPhone outside, then it disconnects from Raspberry Pi. MacBook sleeps or shutdowns, then it disconnects from Raspberry Pi in the same way. So I wanted to reconnect them with Raspberry Pi automatically when they is connectable even if they disconnect from it, and keep connecting. That’s why I made this tool.

Troubleshooting

Failed to create secure directory

Problem

An error occurs like this.

Failed to create secure directory (/run/user/1000/pulse/): No such file or directory

Solution

Restart PulseAudio daemon and system.

systemctl --user restart pulseaudio
sudo reboot

bluetoothctl-autoconnector's People

Contributors

noraworld avatar yasuwoh avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.