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

Add multiple command line arguments for UDC, Interface, BT alias #5

Merged
merged 11 commits into from
Dec 23, 2024

Conversation

KreAch3R
Copy link
Contributor

The below patches are complimentary to the awesome work you have done with this repo.

They install:

--btalias          Specify the name of the BLE host device
--interface      Specify the interface of the Wi-Fi hotspot
--udc              Specify the UDC controller to use

It is an attempt to stop aa-proxy-rs and aawg from hardcoding a lot of stuff, which should be tunable. Network information is being actively parsed from system.

Choosing udc controller may be a minor detail, but it's needed if one needs to use dummy_hcd as the controller, and it's better to specify than the default "choose the first one" option.

Bear in mind that this is my first time writing anything in Rust/C++, so comments / fixes are welcome.

KreAch3R and others added 11 commits December 23, 2024 00:00
This is too important information to be left out with the debug flag. Also, it doesn't produce a lot of output, so it won't clog the regular log.
Allow the user to specify which udc controller to use.
DWC2 / usb-gadget / fe98000.usb is not the only one available.
AA Wireless Dongle and derivatives work by creating a Wi-Fi hotspot by
setting values in /etc/hostapd/hostapd.conf and relying on the host system
having static interface named "wlan0" and ip "10.0.0.1"

Instead of having these values hardcoded, parse hostapd.conf and check
the "wlan0" interface for its IPv4 address, and use those.

In an upcoming commit, we should become able to specify the interface.
Allow the user to specify which network interface is creating the Wi-Fi
hotspot on the host system

It defaults to the wlan0, 10.0.0.1 setup of AA Wireless Dongle
Allow the user to rename the BLE advertised name of the host system
@manio
Copy link
Owner

manio commented Dec 23, 2024

Thank you for the PR!

I added some cleanup commits but at the final test on the Pi it ended up with panic because wrong hostapd.conf location. Let's just stick with the location which is on the WirelessAndroidAutoDongle project - if you need other for your application please provide additional PR for setting this as a parameter.

@manio manio merged commit 8c16b3d into manio:main Dec 23, 2024
1 check passed
@KreAch3R
Copy link
Contributor Author

Thank you for the cleanup commits, I learned some things! And thank you for merging.

I was stumped at the hostapd.conf location. It didn't even cross my mind that it isn't the default location, I didn't notice the path on the WirelessAndroidAutoDongle project.

I found the reason, it's because on Raspbian (buster, at least), hostapd starts from a systemd service that sets the DAEMON_CONF to /etc/hostapd/hostapd.conf :

pi@raspberrypi:/etc/init.d $ cat /lib/systemd/system/hostapd.service
...
[Service]
Type=forking
PIDFile=/run/hostapd.pid
Restart=on-failure
RestartSec=2
Environment=DAEMON_CONF=/etc/hostapd/hostapd.conf
EnvironmentFile=-/etc/default/hostapd
ExecStart=/usr/sbin/hostapd -B -P /run/hostapd.pid -B $DAEMON_OPTS ${DAEMON_CONF}
...

While on buildroot created systems, it's getting installed on /etc/hostapd.conf for no reason, as far as I can tell: buildroot/buildroot@13f364d and then it gets used here.

That's a bummer, I wish the Buildroot developers kept the path same like on other distros. I'm not sure I like adding another argument for that, seems too specific, I can certainly keep the change local. If I come up with something elegant, I'll submit another PR.

@manio
Copy link
Owner

manio commented Dec 24, 2024

If I come up with something elegant, I'll submit another PR.

done in: b2bbf1a

@KreAch3R
Copy link
Contributor Author

If I come up with something elegant, I'll submit another PR.

done in: b2bbf1a

Oh nice, it was indeed like 4 lines of code, nice usage of default value again. Great, thanks!

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.

2 participants