Skip to content

Commit

Permalink
Fix build and get working in rM-docker
Browse files Browse the repository at this point in the history
  • Loading branch information
Eeems committed Dec 10, 2023
1 parent b944a75 commit ccfa049
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 18 deletions.
12 changes: 11 additions & 1 deletion applications/system-service/digitizerhandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class DigitizerHandler : public QThread {
event_device touchScreen_device(deviceSettings.getTouchDevicePath(), O_RDWR);
if(touchScreen_device.fd == -1){
O_WARNING("Failed to open event device: " << touchScreen_device.device.c_str());
throw QException();

Check notice on line 35 in applications/system-service/digitizerhandler.h

View check run for this annotation

codefactor.io / CodeFactor

applications/system-service/digitizerhandler.h#L35

Redundant blank line at the end of a code block should be deleted. (whitespace/blank_line)
}
instance = new DigitizerHandler(touchScreen_device, "touchscreen");
return instance;
Expand Down Expand Up @@ -60,11 +60,17 @@ class DigitizerHandler : public QThread {
}
void setEnabled(bool enabled){ m_enabled = enabled; }
void write(ushort type, ushort code, int value){
if(device.fd == -1){
return;
}
auto event = createEvent(type, code, value);
::write(device.fd, &event, sizeof(input_event));
O_DEBUG("Emitted event " << event.input_event_sec << event.input_event_usec << type << code << value);
}
void write(input_event* events, size_t size){
if(device.fd == -1){
return;
}
::write(device.fd, events, size);
}
void syn(){
Expand All @@ -84,6 +90,10 @@ class DigitizerHandler : public QThread {

protected:
void run(){
if(device.fd == -1){
O_WARNING("No device, not starting for thread");
return;
}
char name[256];
memset(name, 0, sizeof(name));
ioctl(device.fd, EVIOCGNAME(sizeof(name)), name);
Expand Down
31 changes: 22 additions & 9 deletions applications/system-service/wifiapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,11 @@ bool WifiAPI::enable(){
if(!hasPermission("wifi")){
return false;
}
if(interfaces().isEmpty()){
O_WARNING("There are no interfaces to enable");
disable();
return false;
}
O_INFO("Turning wifi on");
if(m_state == Off){
setState(Disconnected);
Expand Down Expand Up @@ -347,12 +352,16 @@ void WifiAPI::reconnect(){
return;
}
O_INFO("Reconnecting to wifi");
QList<QDBusPendingReply<void>> replies;
for(auto interface : interfaces()){
replies.append(interface->Reconnect());
}
for(auto reply : replies){
reply.waitForFinished();
try{
QList<QDBusPendingReply<void>> replies;
for(auto interface : interfaces()){
replies.append(interface->Reconnect());
}
for(auto reply : replies){
reply.waitForFinished();
}
}catch(const std::exception& e){
O_WARNING("Failed to reconnect to wifi: " << e.what());
}
}

Expand Down Expand Up @@ -689,10 +698,14 @@ void WifiAPI::PropertiesChanged(const QVariantMap& properties){

QList<Interface*> WifiAPI::interfaces(){
QList<Interface*> result;
for(auto wlan : wlans){
if(wlan->interface() != nullptr){
result.append(wlan->interface());
try{
for(auto wlan : wlans){
if(wlan->interface() != nullptr){
result.append(wlan->interface());
}
}
}catch(const std::exception& e){
O_WARNING("Failed to get wifi interfaces: " << e.what());
}
return result;
}
Expand Down
2 changes: 1 addition & 1 deletion shared/liboxide/debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace Oxide {
.arg(::getpgrp())
.arg(::getpid())
.arg(::gettid())
.arg(Oxide::getAppName().c_str())
.arg(Oxide::getAppName(false).c_str())
.toStdString();
}

Expand Down
2 changes: 1 addition & 1 deletion shared/liboxide/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ namespace Oxide {
* \param Don't use qApp's application name
* \return The name of the application
*/
LIBOXIDE_EXPORT std::string getAppName(bool ignoreQApp = false);
LIBOXIDE_EXPORT std::string getAppName(bool ignoreQApp);
/*!
* \brief Print the current backtrace
*/
Expand Down
4 changes: 4 additions & 0 deletions shared/liboxide/oxide_sentry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,10 @@ namespace Oxide::Sentry{
void set_tag(Transaction* transaction, const std::string& name, const std::string& tag){
#ifdef SENTRY
sentry_transaction_set_tag_n(transaction->inner, name.c_str(), name.size(), tag.c_str(), tag.size());
#else
Q_UNUSED(transaction);
Q_UNUSED(name);
Q_UNUSED(tag);
#endif
}

Expand Down
6 changes: 3 additions & 3 deletions shared/liboxide/tarnish.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,7 @@ namespace Oxide::Tarnish {
if(reply.isError()){
O_WARNING("Unable to request existing windows:" << reply.error().message());
}else{
auto windowName = QString::fromStdString(Oxide::getAppName());
auto windowName = QString::fromStdString(Oxide::getAppName(false));
for(QDBusObjectPath qpath : reply.value()){
auto path = qpath.path();
if(path == "/"){
Expand All @@ -916,9 +916,9 @@ namespace Oxide::Tarnish {
}
QDBusPendingReply<QDBusObjectPath> reply;
if(fbRequestedGeometry.isNull()){
reply = api_gui->createWindow(QString::fromStdString(Oxide::getAppName()), fbRequestedFormat);
reply = api_gui->createWindow(QString::fromStdString(Oxide::getAppName(false)), fbRequestedFormat);
}else{
reply = api_gui->createWindow(fbRequestedGeometry, QString::fromStdString(Oxide::getAppName()), fbRequestedFormat);
reply = api_gui->createWindow(fbRequestedGeometry, QString::fromStdString(Oxide::getAppName(false)), fbRequestedFormat);
}
reply.waitForFinished();
if(reply.isError()){
Expand Down
6 changes: 3 additions & 3 deletions tests/liboxide/test_Debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ void test_Debug::test_debugEnabled(){
}

void test_Debug::test_getAppName(){
QCOMPARE(QString::fromStdString(Oxide::getAppName()), QString("liboxide"));
QCOMPARE(QString::fromStdString(Oxide::getAppName(false)), QString("liboxide"));
qApp->setApplicationName("liboxide-test");
QCOMPARE(QString::fromStdString(Oxide::getAppName()), QString("liboxide-test"));
QCOMPARE(QString::fromStdString(Oxide::getAppName(false)), QString("liboxide-test"));
qApp->setApplicationName("liboxide");
QCOMPARE(QString::fromStdString(Oxide::getAppName()), QString("liboxide"));
QCOMPARE(QString::fromStdString(Oxide::getAppName(false)), QString("liboxide"));
QCOMPARE(QString::fromStdString(Oxide::getAppName(true)), QString("liboxide"));
// TODO - test /proc/self/comm changing
// TODO - test /proc/self/exe changing
Expand Down

0 comments on commit ccfa049

Please sign in to comment.