Skip to content

Commit

Permalink
wifi option (todo)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasjapan committed Feb 12, 2018
1 parent d1dbbbb commit 644b4d1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion hooks.default/connect
@@ -1,3 +1,6 @@
#!/bin/bash -x

ogg123 /usr/share/sounds/freedesktop/stereo/service-login.oga
ogg123 /usr/share/sounds/freedesktop/stereo/service-login.oga

# disconnect wifi to prevent dropouts - TODO: check what permissions bt-speaker might need for this (netdev group?)
# ifconfig wlan0 down &
5 changes: 4 additions & 1 deletion hooks.default/disconnect
@@ -1,3 +1,6 @@
#!/bin/bash -x

ogg123 /usr/share/sounds/freedesktop/stereo/service-logout.oga
ogg123 /usr/share/sounds/freedesktop/stereo/service-logout.oga

# reenable wifi - TODO: check what permissions bt-speaker might need for this (netdev group?)
# ifconfig wlan0 up &

3 comments on commit 644b4d1

@djh816
Copy link
Contributor

@djh816 djh816 commented on 644b4d1 Feb 17, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sadly it looks like root is required for this. Maybe an addition to install script that mentions or prompts for edit to pi's /boot/config.txt to add dtoverlay=pi3-disable-wifi? (Any ifconfig up or down will require root so unless script wants to be run as root this is only feasible option I see)

Edit: This likely only affects Pi 3 and maybe current Pis. It's in raspian master boot firmware as a flag. Maybe other routes for Pi Zero or earlier Pis? Running raspi-config interactively on any should let you disable wifi though, maybe just better to put a warning on install like "bt-speaker installed. If you notice wifi causing disconnects, please run raspi-config to disable wifi." Other route is editing bt-speaker user for those permissions with similar passwd edits:
bt-speaker ALL = (ALL) NOPASSWD: /sbin/ifup wlan0, /sbin/ifdown wlan0

@vdwees
Copy link

@vdwees vdwees commented on 644b4d1 Apr 13, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on my pi I do something like:
btspeaker ALL = (ALL) NOPASSWD: /etc/bt_speaker/hooks/connect, /etc/bt_speaker/hooks/disconnect
... it works well for me but it is not ideal

@laurentdebricon
Copy link

@laurentdebricon laurentdebricon commented on 644b4d1 Mar 31, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i have just applied this :

root# visudo
add under # User privilege specification , after root line :
btspeaker ALL=(root) NOPASSWD :/sbin/ifconfig *

and then in /etc/bt_speaker/hooks/connect
it's :
sudo ifconfig wlan0 down

in /etc/bt_speaker/hooks/disconnect
it's :
sudo ifconfig wlan0 up

thanks for this great project, too bad even with raspberry 3b, wifi and bluetooth are still not friends.

Please sign in to comment.