UBports Robot Logo UBports Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    How to stop and restart Bluetooth service?

    Scheduled Pinned Locked Moved Solved Support
    bluetoothsmartwatch
    17 Posts 4 Posters 1.6k Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
      Reply
      • Reply as topic
      Log in to reply
      This topic has been deleted. Only users with topic management privileges can see it.
      • MoemM Offline
        Moem
        last edited by Moem

        I have found that the most reliable way to reconnect my smartwatch in the morning is to power down the phone completely, then reboot it. It will then reconnect with no further intervention.
        Just switching bluetooth off and on does not do it; neither does a normal restart.

        So I think I want to completely stop and start bluez (and related services? Maybe?). Is there any way to make that easy? With a launcher of some kind?

        Any pointers would be welcome.

        AntiDroidA 1 Reply Last reply Reply Quote 0
        • AntiDroidA Offline
          AntiDroid @Moem
          last edited by

          @moem You could try

          sudo service bluetooth restart
          

          Or maybe even this old trick to get bluetooth speakers to reconnect on Xenial. I do not know if it will work on UT.

          rfkill block bluetooth
          
          rfkill unblock bluetooth
          
          

          OnePlus One with UT OTA-15 daily driver. I would be testing the Halium 7.1 port if I could roll back to OTA-15
          OnePlus 6T PostmarketOS Custom Gnome on Mainline Kernel

          MoemM 2 Replies Last reply Reply Quote 0
          • MoemM Offline
            Moem
            last edited by

            Sorry, and thank you, but I was hoping for a nice clicky-clicky thing or a way to make one... the UT terminal and me, we're not friends. Without an actual keyboard... well, let's not go there.

            I'm looking for something that is easier than a complete reboot. Otherwise I can just do the reboot.

            K 1 Reply Last reply Reply Quote 0
            • K Offline
              kugiigi @Moem
              last edited by

              @moem I would assume toggling bluetooth off and on doesn't work. Some issues can be fixed by that.
              Also, using the terminal with OSK is quite decent on UT. Tap for Tab, swipe up and down for history and swipe 2 finger for scrolling. There are also shortcut keys at the bottom bar.

              MoemM 1 Reply Last reply Reply Quote 0
              • MoemM Offline
                Moem @kugiigi
                last edited by Moem

                @kugiigi said in How to stop and restart Bluetooth service?:

                I would assume toggling bluetooth off and on doesn't work.

                Right. It doesn't, like I said.

                As for the terminal, I do not understand it and there are no instructions anywhere that I have seen. I'm happy that you consider it easy to use. I do not. I do not even understand what the shortcut keys do. A terminal solution is never going to be easier for me than a reboot. Please take my word for it.

                K 1 Reply Last reply Reply Quote 0
                • K Offline
                  kugiigi @Moem
                  last edited by

                  @moem Oh sorry, I missed that šŸ˜…
                  To me, using the terminal would be a lot easier and faster than rebooting. You can create a bash script in your home directory with the commands needed. Then on the terminal you can simply type the first few characters of the bash script in the terminal tap the screen enter. I use this trick on the pinephone whenever wifi stops working.

                  MoemM 1 Reply Last reply Reply Quote 0
                  • MoemM Offline
                    Moem @kugiigi
                    last edited by

                    @kugiigi said in How to stop and restart Bluetooth service?:

                    You can create a bash script in your home directory with the commands needed.

                    See, now we are getting somewhere... šŸ™‚
                    Might there be a way to create a launcher to call up that script?

                    K KenedaK 2 Replies Last reply Reply Quote 0
                    • K Offline
                      kugiigi @Moem
                      last edited by

                      @moem I believe you can create a desktop file manually in ~/.local/share/applications

                      MoemM 1 Reply Last reply Reply Quote 0
                      • MoemM Offline
                        Moem @kugiigi
                        last edited by

                        @kugiigi Oooh. Good info, thank you! I will investigate.

                        1 Reply Last reply Reply Quote 0
                        • KenedaK Offline
                          Keneda @Moem
                          last edited by Keneda

                          @moem said in How to stop and restart Bluetooth service?:

                          Might there be a way to create a launcher to call up that script?

                          If i remember correctly, Launcher Modular allows ro create shortcuts of that kind (command line).

                          2015-2023 : Meizu MX4 ā˜ ļøāš°ļøāœļø
                          2023-2024 : Nexus 5 ā˜ ļøāš°ļøāœļø
                          2024-***** : FPOS Fairphone 5 waiting UT for freedom šŸ˜‰
                          šŸ‡²šŸ‡«šŸ‡¬šŸ‡§

                          MoemM 1 Reply Last reply Reply Quote 0
                          • MoemM Offline
                            Moem @Keneda
                            last edited by

                            @keneda That would be a great solution, thank you very much! Going to look into that...

                            AntiDroidA 1 Reply Last reply Reply Quote 0
                            • AntiDroidA Offline
                              AntiDroid @Moem
                              last edited by AntiDroid

                              @moem if you follow the clickable instructions for setting up an app development enviroment the first thing you do after installing all the required dependencies and programs is you generate an app template. That template is a program with a single button in the middle that when you click it, it prints "hello world" to the command line. I would think it would be easy to change that to one of the commands above (after manually testing via the command line at least once). It would be a great way to get into making yout own programs too.

                              OnePlus One with UT OTA-15 daily driver. I would be testing the Halium 7.1 port if I could roll back to OTA-15
                              OnePlus 6T PostmarketOS Custom Gnome on Mainline Kernel

                              MoemM 1 Reply Last reply Reply Quote 0
                              • MoemM Offline
                                Moem @AntiDroid
                                last edited by

                                @antidroid That's not something I'm interested in, but thanks!

                                1 Reply Last reply Reply Quote 0
                                • MoemM Offline
                                  Moem @AntiDroid
                                  last edited by

                                  This post is deleted!
                                  1 Reply Last reply Reply Quote 0
                                  • MoemM Offline
                                    Moem @AntiDroid
                                    last edited by

                                    @antidroid said in How to stop and restart Bluetooth service?:

                                    @moem You could try

                                    sudo service bluetooth restart
                                    

                                    Or maybe even this old trick to get bluetooth speakers to reconnect on Xenial. I do not know if it will work on UT.

                                    rfkill block bluetooth
                                    
                                    rfkill unblock bluetooth
                                    
                                    

                                    I tried both of these options. The first one was not a succes: BT stopped and never started again (which a reboot solved). The second one worked very well!

                                    So in Launcher Modular, which I'm using anyway, I made a custom icon as suggested by @Keneda. This is a winning combination.
                                    The command I used is

                                    rfkill block bluetooth && rfkill unblock bluetooth
                                    

                                    and this morning, when I woke up, the Pebble was unlinked (it has an option to unlink when it does not sense any motion for half an hour, to save battery power) so I tapped the icon.
                                    The notifier for BT flashed very briefly and immediately went active, and the Pebble buzzed to indicate connection.
                                    In other words, this is a complete success and I'm now going to mark it solved and celebrate with a mug of my best tea. šŸŽ‰

                                    Thank you, folks, for some great information!

                                    KenedaK 1 Reply Last reply Reply Quote 1
                                    • KenedaK Offline
                                      Keneda @Moem
                                      last edited by

                                      @moem
                                      You're welcome. I hope Launcher Modular to grow as it's a good app, but some bugs on MX4 unfortunatly.

                                      2015-2023 : Meizu MX4 ā˜ ļøāš°ļøāœļø
                                      2023-2024 : Nexus 5 ā˜ ļøāš°ļøāœļø
                                      2024-***** : FPOS Fairphone 5 waiting UT for freedom šŸ˜‰
                                      šŸ‡²šŸ‡«šŸ‡¬šŸ‡§

                                      MoemM 1 Reply Last reply Reply Quote 0
                                      • MoemM Offline
                                        Moem @Keneda
                                        last edited by

                                        @keneda said in How to stop and restart Bluetooth service?:

                                        some bugs on MX4 unfortunatly

                                        Sorry to hear that! On OpO, it's pretty much flawless. It really helped me when switching from Android... I felt a lot more at home (sorry, devs). And I like having an analog clock on the home screen.

                                        1 Reply Last reply Reply Quote 0
                                        • KenedaK Keneda referenced this topic on
                                        • KenedaK Keneda referenced this topic on
                                        • KenedaK Keneda referenced this topic on
                                        • First post
                                          Last post