Skip to content

Commit a6d6809

Browse files
authored
Cleanup and finishing touches (#39)
* Changed target name to beaglecfg * CI for build and release * Include CPack for Debian pkg * Modified README with asciinema2cast generated gif * Fixed target install path in CMake * Cleanup: Temporary removal of non-implemented stuff Removal of errors on stderr Following stuff has not been implemented yet * Error handling gracefully * Debug statements for user * Display options Hence instead of keeping strays, I have cleaned up a bit. * TODO: Handle using logging libs available
1 parent 3db59a3 commit a6d6809

11 files changed

Lines changed: 33 additions & 65 deletions

File tree

.github/workflows/armhf-build.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ jobs:
3232
armhf__filename__=$(echo $(ls ${{steps.armhf-artifact-download.outputs.download-path}} | grep ..armhf.deb) | tr -d '\n')
3333
version__name__=${armhf__filename__#*-}
3434
name__=$(echo ${armhf__filename__%-*} | tr -d '\n')
35-
trailing_=$(git rev-list --count HEAD | tr -d '\n')
3635
version__=$(cat ../VERSION)
3736
echo "name__=$name__" >> $GITHUB_ENV
3837
echo "version__=$version__" >> $GITHUB_ENV

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ add_executable(${PROJECT_NAME}
3131
src/ui/panel/pru/pru_impl.cpp
3232
src/ui/panel/wifi/wifi_impl.cpp
3333
src/ui/panel/passwd/passwd.cpp
34-
src/ui/panel/display/display.cpp
3534
src/ui/panel/ssh/ssh.cpp
3635
src/ui/ui.cpp
3736
src/ui/ui.hpp
@@ -89,6 +88,8 @@ configure_file(
8988
${CMAKE_CURRENT_BINARY_DIR}/src/environment.hpp
9089
)
9190

91+
install(TARGETS ${PROJECT_NAME} DESTINATION /usr/sbin)
92+
9293
if(VERSION_FILE)
9394
execute_process(
9495
COMMAND bash -c "echo -n ${CMAKE_PROJECT_VERSION}-${git_version} > VERSION"

README.md

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,32 @@
1-
# beagle-config
1+
<br />
2+
<p align="center">
3+
<a href="https://github.com/SAtacker/beagle-config">
4+
<img src="assets/images/beaglecfg.png" alt="Logo" width="481" height="75">
5+
</a>
6+
<p align="center">
7+
Configure your beagle devices easily.
8+
<br/>
9+
<br/>
10+
<a href="https://github.com/SAtacker/beagle-config/wiki"><strong>Explore the docs »</strong></a>
11+
<br />
12+
<a href="https://github.com/SAtacker/beagle-config/issues">Report Bug</a>
13+
·
14+
<a href="https://github.com/SAtacker/beagle-config/wiki/Examples">Examples</a>
15+
.
16+
<a href="https://github.com/SAtacker/beagle-config/issues">Request Feature</a>
17+
·
18+
<a href="https://github.com/SAtacker/beagle-config/pulls">Send a Pull Request</a>
19+
</p>
20+
</p>
21+
22+
<p align="center">
23+
<img src="https://github.com/SAtacker/beagle-config/actions/workflows/armhf-build.yml/badge.svg">
24+
<img src="https://img.shields.io/github/stars/SAtacker/beagle-config">
25+
<img src="https://img.shields.io/github/forks/SAtacker/beagle-config">
26+
<img src="https://img.shields.io/github/issues/SAtacker/beagle-config">
27+
<img src="https://img.shields.io/github/repo-size/SAtacker/beagle-config">
28+
<img src="https://img.shields.io/github/license/SAtacker/beagle-config">
29+
</p>
230

331
## Build
432

@@ -7,7 +35,7 @@ mkdir -p build && cd build
735
cmake ..
836
make -j$(nproc)
937
```
10-
### Current Status
11-
[![asciicast](https://asciinema.org/a/429873.svg)](https://asciinema.org/a/429873)
38+
### Looks like
39+
![gif](assets/beaglecfg.gif)
1240

1341
* Note: For Cross Compiling a script `cross_compile.sh` should work fine on debian based distros.

assets/beaglecfg.gif

263 KB
Loading

assets/images/beaglecfg.png

45.3 KB
Loading

assets/images/cast.gif

-78.8 KB
Binary file not shown.

src/ui/panel/display/display.cpp

Lines changed: 0 additions & 29 deletions
This file was deleted.

src/ui/panel/ics/ics_impl.cpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ class ICSImpl : public PanelBase {
8484
// Create a socket.
8585
int socket_file_descriptor = socket(AF_INET, SOCK_DGRAM, 0);
8686
if (socket_file_descriptor < 0) {
87-
std::cerr << "Error opening socket " << std::endl;
8887
return -1;
8988
}
9089

@@ -113,8 +112,6 @@ class ICSImpl : public PanelBase {
113112
if (!route_add_) {
114113
int error = ioctl(socket_file_descriptor, SIOCDELRT, &route);
115114
if (error != 0) {
116-
std::cerr << "Error ioctl del rt_gateway: " << gateway_str << "\n"
117-
<< strerror(errno) << std::endl;
118115
}
119116
shutdown(socket_file_descriptor, SHUT_RDWR);
120117
return -1;
@@ -123,15 +120,10 @@ class ICSImpl : public PanelBase {
123120
/* Add it */
124121
int error = ioctl(socket_file_descriptor, SIOCADDRT, &route);
125122
if (error != 0) {
126-
std::cerr << "Error ioctl add rt_gateway: " << gateway_str << "\n"
127-
<< strerror(errno) << std::endl;
128123
}
129124

130125
int nameserver_count = CountNameserver();
131126
if (nameserver_count >= 2) {
132-
std::cerr << "Servers already exist: nameserver_count = "
133-
<< nameserver_count << std::endl;
134-
135127
shutdown(socket_file_descriptor, SHUT_RDWR);
136128
return -1;
137129
}
@@ -140,7 +132,6 @@ class ICSImpl : public PanelBase {
140132
std::ofstream file("/etc/resolv.conf", std::ofstream::app);
141133

142134
if (!file.good()) {
143-
std::cerr << "Permission denied" << std::endl;
144135
shutdown(socket_file_descriptor, SHUT_RDWR);
145136
return -1;
146137
}
@@ -154,8 +145,6 @@ class ICSImpl : public PanelBase {
154145
file << "nameserver " << dns_1_str << std::endl;
155146
file << "nameserver " << dns_2_str << std::endl;
156147

157-
std::cerr << "Successful " << dns_1_str << " " << dns_2_str << std::endl;
158-
159148
/* Close the socket */
160149
shutdown(socket_file_descriptor, SHUT_RDWR);
161150
return 0;
@@ -166,7 +155,6 @@ class ICSImpl : public PanelBase {
166155
// Create the config directory if it doesn't exist yet.
167156
if (!std::filesystem::is_directory(UserShareConfigPath())) {
168157
if (!std::filesystem::create_directories(UserShareConfigPath())) {
169-
std::cerr << "Error Creating Directory" << std::endl;
170158
return;
171159
}
172160
}
@@ -177,8 +165,6 @@ class ICSImpl : public PanelBase {
177165
config_file.close();
178166
config_file.open(BeagleConfigPath(), std::ios::app);
179167
if (!config_file) {
180-
std::cerr << "load:: Error opening config file" << BeagleConfigPath()
181-
<< std::endl;
182168
return;
183169
}
184170
config_file.close();
@@ -223,10 +209,8 @@ class ICSImpl : public PanelBase {
223209
}
224210

225211
void StoreConfig() {
226-
std::cerr << "Storing:: " << BeagleConfigPath() << std::endl;
227212
std::ofstream config_file(BeagleConfigPath());
228213
if (!config_file) {
229-
std::cerr << "Store :: Error opening config file" << std::endl;
230214
return;
231215
}
232216

src/ui/panel/panel.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ Panel WiFi(ScreenInteractive*);
2828
Panel BackgroundWorker(ScreenInteractive*);
2929
Panel About();
3030
Panel passwd();
31-
Panel display();
3231
Panel ssh();
3332
} // namespace panel
3433
} // namespace ui

src/ui/panel/wifi/wifi_impl.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,8 @@ class WiFiImpl : public PanelBase {
173173
}
174174
}
175175
if (file_path.empty()) {
176-
std::cerr << "Network Not found :- " << data.name << std::endl;
177176
return;
178177
}
179-
std::cout << "Calling store: " << file_path << std::endl;
180178
StoreConnmanFile(file_path.c_str());
181179
activity = ActivityMain;
182180
}
@@ -196,7 +194,6 @@ class WiFiImpl : public PanelBase {
196194
break;
197195
}
198196
}
199-
std::cout << "Calling empty: " << file_path << std::endl;
200197
EmptyConnmanConfig(file_path.c_str());
201198
activity = ActivityMain;
202199
}
@@ -219,11 +216,9 @@ class WiFiImpl : public PanelBase {
219216
}
220217

221218
int StoreConnmanFile(const char* path) {
222-
std::cout << "Storing in " << path << std::endl;
223219
std::fstream connman_config(
224220
path, std::fstream::in | std::fstream::out | std::fstream::trunc);
225221
if (!connman_config.is_open()) {
226-
std::cerr << "Error opening connman config " << path << std::endl;
227222
return -1;
228223
} else {
229224
std::time_t time_ = std::chrono::system_clock::to_time_t(
@@ -246,12 +241,9 @@ class WiFiImpl : public PanelBase {
246241
}
247242

248243
void EmptyConnmanConfig(const char* path) {
249-
std::cout << "Emptying " << path << std::endl;
250244
std::fstream connman_config(
251245
path, std::fstream::in | std::fstream::out | std::fstream::trunc);
252246
if (!connman_config.is_open()) {
253-
std::cerr << "Emptying: Error opening connman config " << path
254-
<< std::endl;
255247
} else {
256248
std::time_t time_ = std::chrono::system_clock::to_time_t(
257249
std::chrono::system_clock::now());
@@ -335,7 +327,6 @@ class WiFiImpl : public PanelBase {
335327
current_line;
336328
}
337329
} else {
338-
std::cerr << "Not finding unique_name" << std::endl;
339330
}
340331
}
341332
result.erase(0, newline_pos + 1);
@@ -371,7 +362,6 @@ class WiFiImpl : public PanelBase {
371362
int skfd = socket(AF_INET, SOCK_DGRAM, 0);
372363

373364
if (skfd < 0) {
374-
std::cerr << "cannot open socket" << std::endl;
375365
return 0;
376366
}
377367

0 commit comments

Comments
 (0)