linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Check for connections and disable bluetooth in shell
@ 2010-08-31  5:58 Jonathan Haug
  2010-08-31  6:04 ` Gustavo F. Padovan
  0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Haug @ 2010-08-31  5:58 UTC (permalink / raw)
  To: linux-bluetooth


Dear bluetooth-experts,

I want to disable bluetooth on my system (via commandline), if there is
no active bluetooth connection -- without being root.

Therefor I need a way to

1.  check if there is an active bluetooth connection

2.  disable bluetooth without being root


For the second part I found

dbus-send --system --type=method_call --dest=org.bluez $(dbus-send
--system --print-reply --dest=org.bluez / org.bluez.Manager.ListAdapters
| awk -F'"' '/at/ {print $2}') org.bluez.Adapter.SetProperty
string:Powered variant:boolean:false

but this doesn't really disable bluetooth: I'm still able to deactivate
bluetooth in the panel.

For the first part I could not find a solution so far.

I'm running Ubuntu 10.04.

Thanks for your help!

Jonathan Haug



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Check for connections and disable bluetooth in shell
  2010-08-31  5:58 Check for connections and disable bluetooth in shell Jonathan Haug
@ 2010-08-31  6:04 ` Gustavo F. Padovan
  2010-10-07  5:01   ` Jonathan Haug
  0 siblings, 1 reply; 3+ messages in thread
From: Gustavo F. Padovan @ 2010-08-31  6:04 UTC (permalink / raw)
  To: Jonathan Haug; +Cc: linux-bluetooth

Hi Jonathan,

* Jonathan Haug <jonathanhaug@wolke7.net> [2010-08-31 07:58:19 +0200]:

> 
> Dear bluetooth-experts,
> 
> I want to disable bluetooth on my system (via commandline), if there is
> no active bluetooth connection -- without being root.
> 
> Therefor I need a way to
> 
> 1.  check if there is an active bluetooth connection

'hcitool conn' can show that to you.

-- 
Gustavo F. Padovan
ProFUSION embedded systems - http://profusion.mobi

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Check for connections and disable bluetooth in shell
  2010-08-31  6:04 ` Gustavo F. Padovan
@ 2010-10-07  5:01   ` Jonathan Haug
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Haug @ 2010-10-07  5:01 UTC (permalink / raw)
  To: linux-bluetooth

Am Dienstag, den 31.08.2010, 03:04 -0300 schrieb Gustavo F. Padovan:
> > 
> > I want to disable bluetooth on my system (via commandline), if there is
> > no active bluetooth connection -- without being root.
> > 
> > Therefor I need a way to
> > 
> > 1.  check if there is an active bluetooth connection
> 
> 'hcitool conn' can show that to you.
> 

Just to complete this thread:

Thanks Gustavo! I'm now using the following script:

		if grep -q off-line /proc/acpi/ac_adapter/ACAD/state; then
			if !(hcitool con | grep -q "state"); then
				rfkill block bluetooth
			fi
		fi

May it be helpful for someone.

Greetings

Jonathan


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-10-07  5:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-31  5:58 Check for connections and disable bluetooth in shell Jonathan Haug
2010-08-31  6:04 ` Gustavo F. Padovan
2010-10-07  5:01   ` Jonathan Haug

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).