zschroeder6212 / pine_gestures Goto Github PK
View Code? Open in Web Editor NEWA simple application to turn on the flashlight when the phone is shaken
A simple application to turn on the flashlight when the phone is shaken
pine64-pinephone:~/pine_gestures$ make
g++ -std=c++11 -o pine_gestures pine_gestures.cpp
In file included from /usr/include/c++/12.2.1/cstring:42,
from pine_gestures.cpp:22:
pine_gestures.cpp: In function 'int ftoi(char*)':
pine_gestures.cpp:54:24: error: cannot convert 'std::nullptr_t' to 'int' in return
54 | return NULL;
| ^~~~
pine_gestures.cpp:59:24: error: cannot convert 'std::nullptr_t' to 'int' in return
59 | return NULL;
| ^~~~
pine_gestures.cpp: In function 'int get_arg(int, char**, char*, char*)':
pine_gestures.cpp:179:20: warning: format not a string literal and no format arguments [-Wformat-security]
179 | sprintf(arg_value, argv[i+1]);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
pine_gestures.cpp: In function 'void usage(char*)':
pine_gestures.cpp:191:21: warning: format '%s' expects a matching 'char*' argument [-Wformat=]
191 | printf("Usage: %s [--shake_cmd ] [--twist_cmd ]\n");
| ~^
| |
| char*
pine_gestures.cpp: In function 'int main(int, char**)':
pine_gestures.cpp:204:35: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
204 | int ret = get_arg(argc, argv, "--shake_cmd", shake_command);
| ^~~~~~~~~~~~~
pine_gestures.cpp:213:31: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
213 | ret = get_arg(argc, argv, "--twist_cmd", twist_command);
| ^~~~~~~~~~~~~
pine_gestures.cpp:233:13: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
233 | if(find("/sys/bus/i2c/drivers/inv-mpu6050-i2c", "0068", IMU_path))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pine_gestures.cpp:233:53: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
233 | if(find("/sys/bus/i2c/drivers/inv-mpu6050-i2c", "0068", IMU_path))
| ^~~~~~
pine_gestures.cpp:235:28: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
235 | if(!find(IMU_path, "iio:device", IMU_path))
| ^~~~~~~~~~~~
pine_gestures.cpp:292:20: warning: format not a string literal and no format arguments [-Wformat-security]
292 | printf(shake_command);
| ^~~~~~~~~~~~~
pine_gestures.cpp:306:20: warning: format not a string literal and no format arguments [-Wformat-security]
306 | printf(twist_command);
| ^~~~~~~~~~~~~
pine_gestures.cpp: In function 'bool find(char*, char*, char*)':
pine_gestures.cpp:87:1: warning: control reaches end of non-void function [-Wreturn-type]
87 | }
| ^
make: *** [Makefile:31: pine_gestures] Error 1
Awesome app!
On my pinephone I have a different path to the accelerometer. For me it was in /sys/bus/i2c/drivers/inv-mpu6050-i2c/1-0068/iio:device3/in_accel_y_raw
I'm running Mobian.
Maybe a simple search for in_accel_y_raw in /sys/bus/i2c/drivers/inv-mpu6050-i2c on startup is enough.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.