Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve bluetooth/wifi on/off settings #37

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Ptosiek
Copy link
Contributor

@Ptosiek Ptosiek commented Oct 5, 2023

[Work in progress]

  • do not use rkfill for bluetooth
  • do not make it RASPI only
  • mv detect_network + no need for global for IO address: bluetooth tethering not only on Raspi

1.I'd rather not used rfkill for wifi too (I end up having to reboot the system anyway to get it back, one way could be to do "ip link set xxx down/up", I think in both case, rfkill or this, the wifi module is powered anyway) ?
2.I realize now the IS_RASPI in some places is because you are running the code on MacOS and can't can't run linux command. So this def won't work for you.
But then, maybe we should introduce a IS_RASPI and IS_LINUX (or IS_VALID_PLATFORM) so these code paths can be tested on a computer too ?

@Ptosiek Ptosiek force-pushed the fix-wifi-bluetooth-detection branch from 7d084c2 to e1236cb Compare October 5, 2023 22:02
@hishizuka
Copy link
Owner

hishizuka commented Oct 5, 2023

Hi, @Ptosiek ,

  1. What I wanted to achieve with this function was to reduce power consumption.
    As you pointed out, this was not possible with rfkill. It can be accomplished by rewriting dtoverlay in boot/config.txt,
    but it requires a reboot. Still, the current consumption is reduced by 30 mA, so it is an effective feature to have available.
    On a flatter note, I have not tried loading and unloading kernel modules, so I will try that next time. This should be common in Linux.
  2. Yes. I was thinking of extending it to IS_LINUX or IS_VALID_PLATFORM since each feature is designed for linux. On Mac and Windows, I want the GUI to work as it does now.
    I am thinking of using Radxa Zero to try out all the features. However, many libraries are not available for Raspberry Pi. (mraa for gpio)

@Ptosiek
Copy link
Contributor Author

Ptosiek commented Oct 6, 2023

  1. Yes, with this branch at least the Bluetooth is powered off now so I guess the consumption should be slightly reduced.
    Loading the kernel module might be an option for the WiFi indeed.
  2. Another option that comes to mind is using containerization to run (test) the app, docker or something. It complexifies a bit the setup but will simplify the code.

I will split out some 'safe' changes from this branch and open another PR with them. This can stay open till we find a solution

@Ptosiek Ptosiek mentioned this pull request Oct 6, 2023
@Ptosiek Ptosiek force-pushed the fix-wifi-bluetooth-detection branch from e1236cb to 60bb560 Compare October 9, 2023 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants