Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Linux Programming
  4. How to verify Bluetooth?

How to verify Bluetooth?

Scheduled Pinned Locked Moved Linux Programming
helplinuxagentic-aitutorialquestion
6 Posts 3 Posters 41 Views 1 Watching
  • 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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    I have "upgraded" to Ubuntu 23.04. "Discovered"it is lacking Bluetooth. Used this opportunity to test "verify Bluetooth " in my code using "bluetoothctl". The command responds correctly , but "gets stuck " in "Waiting to connect to bluetoothd...". Used same command in "terminal" with same result. Can somebody suggest similar command or "bluetoothctl"command option (timeout ?)so it does detect lack of Bluetooth, but does not get stuck. Temporary , I do verify Bluetooth not working by looking for "Agent registered " failure - which is correct response when Bluetooth is OK, actually running. Then if it runs I can "exit" from command. Help is much appreciated. Thanks

    nov25-1@nov251-desktop:~$ bluetoothctl
    Waiting to connect to bluetoothd...

    L J 3 Replies Last reply
    0
    • L Lost User

      I have "upgraded" to Ubuntu 23.04. "Discovered"it is lacking Bluetooth. Used this opportunity to test "verify Bluetooth " in my code using "bluetoothctl". The command responds correctly , but "gets stuck " in "Waiting to connect to bluetoothd...". Used same command in "terminal" with same result. Can somebody suggest similar command or "bluetoothctl"command option (timeout ?)so it does detect lack of Bluetooth, but does not get stuck. Temporary , I do verify Bluetooth not working by looking for "Agent registered " failure - which is correct response when Bluetooth is OK, actually running. Then if it runs I can "exit" from command. Help is much appreciated. Thanks

      nov25-1@nov251-desktop:~$ bluetoothctl
      Waiting to connect to bluetoothd...

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      See https://www.makeuseof.com/manage-bluetooth-linux-with-bluetoothctl/[^]

      1 Reply Last reply
      0
      • L Lost User

        I have "upgraded" to Ubuntu 23.04. "Discovered"it is lacking Bluetooth. Used this opportunity to test "verify Bluetooth " in my code using "bluetoothctl". The command responds correctly , but "gets stuck " in "Waiting to connect to bluetoothd...". Used same command in "terminal" with same result. Can somebody suggest similar command or "bluetoothctl"command option (timeout ?)so it does detect lack of Bluetooth, but does not get stuck. Temporary , I do verify Bluetooth not working by looking for "Agent registered " failure - which is correct response when Bluetooth is OK, actually running. Then if it runs I can "exit" from command. Help is much appreciated. Thanks

        nov25-1@nov251-desktop:~$ bluetoothctl
        Waiting to connect to bluetoothd...

        J Offline
        J Offline
        jschell
        wrote on last edited by
        #3

        I certainly cannot find a way to change a timeout for it. Presumably this is your actual situation since it was not clear whether you fixed the first. 1. Bluetooth is not installed 2. You ran the command. 3. It blocks. Given that then in terms of error detection for a tool you would need to do the following 1. Code something that can run the command asynchronously such as a thread. 2. The caller initiates the call with a timer (that will expire.) 3. If the timer fires a timeout then the tool reports 'bluetooth not found' 4. If the command returns (before the timeout) cancel the timer, then process the results from the command.

        1 Reply Last reply
        0
        • L Lost User

          I have "upgraded" to Ubuntu 23.04. "Discovered"it is lacking Bluetooth. Used this opportunity to test "verify Bluetooth " in my code using "bluetoothctl". The command responds correctly , but "gets stuck " in "Waiting to connect to bluetoothd...". Used same command in "terminal" with same result. Can somebody suggest similar command or "bluetoothctl"command option (timeout ?)so it does detect lack of Bluetooth, but does not get stuck. Temporary , I do verify Bluetooth not working by looking for "Agent registered " failure - which is correct response when Bluetooth is OK, actually running. Then if it runs I can "exit" from command. Help is much appreciated. Thanks

          nov25-1@nov251-desktop:~$ bluetoothctl
          Waiting to connect to bluetoothd...

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Sorry for delay, had to move my PC and it all broke. Appreciate both suggestions, will use both. While testing, found out that some commands requires "boot access" on "check if enabled" and no "root access" "enable service" -- weird and incontinent.

          L 1 Reply Last reply
          0
          • L Lost User

            Sorry for delay, had to move my PC and it all broke. Appreciate both suggestions, will use both. While testing, found out that some commands requires "boot access" on "check if enabled" and no "root access" "enable service" -- weird and incontinent.

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            Found bluetoothctl --timeout BUT it is not working as expected. Any idea ? ( Maybe it is not going to work when no bluettoth is NOT running ?)

            nov25-1@nov251-desktop:~$ bluetoothctl --timeout
            bluetoothctl: option '--timeout' requires an argument
            bluetoothctl ver 5.66
            Usage:
            bluetoothctl [--options] [commands]
            Options:
            --agent Register agent handler: --endpoints Register Media endpoints
            --monitor Enable monitor output
            --timeout Timeout in seconds for non-interactive mode
            --version Display version
            --help Display help
            nov25-1@nov251-desktop:~$ bluetoothctl --timeout 20
            Waiting to connect to bluetoothd...

            K 1 Reply Last reply
            0
            • L Lost User

              Found bluetoothctl --timeout BUT it is not working as expected. Any idea ? ( Maybe it is not going to work when no bluettoth is NOT running ?)

              nov25-1@nov251-desktop:~$ bluetoothctl --timeout
              bluetoothctl: option '--timeout' requires an argument
              bluetoothctl ver 5.66
              Usage:
              bluetoothctl [--options] [commands]
              Options:
              --agent Register agent handler: --endpoints Register Media endpoints
              --monitor Enable monitor output
              --timeout Timeout in seconds for non-interactive mode
              --version Display version
              --help Display help
              nov25-1@nov251-desktop:~$ bluetoothctl --timeout 20
              Waiting to connect to bluetoothd...

              K Offline
              K Offline
              k5054
              wrote on last edited by
              #6

              That's pretty clear. You need to tell bluetoothctl how long to wait e.g. bluetoothctl --timeout 2 should time out after 2 seconds. Who knows, maybe you could even use a floating point value e.g. --timeout 1.5 for finer grain control. Normally, though, a long option is specified as --timeout=2, so you might try that as well if the above does not work. I've checked a few of web sites, but none of them were able to help in this regard. Still a little experimentation on your part should clear that up. When you get it sorted, maybe post a note the to the maintainers that it needs to be explained better.

              Keep Calm and Carry On

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups