• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
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.
    • M Offline
      Moem
      last edited by Moem 25 Feb 2021, 10:17

      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.

      A 1 Reply Last reply 25 Feb 2021, 11:44 Reply Quote 0
      • A Offline
        AntiDroid @Moem
        last edited by 25 Feb 2021, 11:44

        @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

        M 2 Replies Last reply 25 Feb 2021, 19:07 Reply Quote 0
        • M Offline
          Moem
          last edited by 25 Feb 2021, 11:50

          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 25 Feb 2021, 12:05 Reply Quote 0
          • K Offline
            kugiigi @Moem
            last edited by 25 Feb 2021, 12:05

            @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.

            M 1 Reply Last reply 25 Feb 2021, 12:18 Reply Quote 0
            • M Offline
              Moem @kugiigi
              last edited by Moem 25 Feb 2021, 12:18

              @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 25 Feb 2021, 12:25 Reply Quote 0
              • K Offline
                kugiigi @Moem
                last edited by 25 Feb 2021, 12:25

                @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.

                M 1 Reply Last reply 25 Feb 2021, 13:29 Reply Quote 0
                • M Offline
                  Moem @kugiigi
                  last edited by 25 Feb 2021, 13:29

                  @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 K 2 Replies Last reply 25 Feb 2021, 13:34 Reply Quote 0
                  • K Offline
                    kugiigi @Moem
                    last edited by 25 Feb 2021, 13:34

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

                    M 1 Reply Last reply 25 Feb 2021, 13:40 Reply Quote 0
                    • M Offline
                      Moem @kugiigi
                      last edited by 25 Feb 2021, 13:40

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

                      1 Reply Last reply Reply Quote 0
                      • K Offline
                        Keneda @Moem
                        last edited by Keneda 25 Feb 2021, 13:59

                        @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 😉
                        🇲🇫🇬🇧

                        M 1 Reply Last reply 25 Feb 2021, 14:49 Reply Quote 0
                        • M Offline
                          Moem @Keneda
                          last edited by 25 Feb 2021, 14:49

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

                          A 1 Reply Last reply 25 Feb 2021, 18:23 Reply Quote 0
                          • A Offline
                            AntiDroid @Moem
                            last edited by AntiDroid 25 Feb 2021, 18:23

                            @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

                            M 1 Reply Last reply 25 Feb 2021, 18:29 Reply Quote 0
                            • M Offline
                              Moem @AntiDroid
                              last edited by 25 Feb 2021, 18:29

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

                              1 Reply Last reply Reply Quote 0
                              • M Offline
                                Moem @AntiDroid
                                last edited by 25 Feb 2021, 19:07

                                This post is deleted!
                                1 Reply Last reply Reply Quote 0
                                • M Offline
                                  Moem @AntiDroid
                                  last edited by 26 Feb 2021, 08:21

                                  @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!

                                  K 1 Reply Last reply 26 Feb 2021, 09:37 Reply Quote 1
                                  • K Offline
                                    Keneda @Moem
                                    last edited by 26 Feb 2021, 09:37

                                    @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 😉
                                    🇲🇫🇬🇧

                                    M 1 Reply Last reply 26 Feb 2021, 10:34 Reply Quote 0
                                    • M Offline
                                      Moem @Keneda
                                      last edited by 26 Feb 2021, 10:34

                                      @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
                                      • K Keneda referenced this topic on 10 Jan 2022, 09:21
                                      • K Keneda referenced this topic on 10 Jan 2022, 09:22
                                      • K Keneda referenced this topic on 10 Jan 2022, 09:37
                                      8 out of 17
                                      • First post
                                        8/17
                                        Last post