Turn off screensaver while openmoko app is running - openmoko

In openmoko (stable hybrid release, SHR), how do you programatically turn-off the screensaver (the dimmed/blank screen after a few seconds of inactivity) just while your app is running?

In X, you can run
xset s off
to turn off the screensaver. Similarly gnome/freedesktop exposes a DBUS API to control and inhibit screensaver mode. I don't know if OpenMoko supports the freedesktop spec, but if it does you should be able to use DBUS directly. You can see how Totem does it here.

FSORaw is a wrapper that you can use externally to claim resources like the display. This will prevent screen blanking. But if it is your own application I would recommend claiming the same display resources within your software.
more about fsoraw and resources

It is possible to do that through the D-BUS API of freesmartphone, it is also possible to prevent suspends.
mdbus -s org.freesmartphone.ousaged /org/freesmartphone/Usage org.freesmartphone.Usage.SetResourcePolicy CPU auto
mdbus -s org.freesmartphone.ousaged /org/freesmartphone/Usage org.freesmartphone.Usage.SetResourcePolicy Display auto
Replace auto with enabled or disabled.
‏You can find the documentation for this D-BUS method at http://git.freesmartphone.org/?p=specs.git;a=blob_plain;f=html/org.freesmartphone.Usage.html;hb=HEAD#GetResourcePolicy

Related

Saving to SQLite from Chrome Extension

There is a new JSWASM approach that allows saving to SQLite (the fast OPFS way) in the browser via a javascript Worker. A sample is here that is (sort of) for a Chrome extension. Ideally, it would allow saving from the background.js, but it's unclear whether a worker can be called from there in MV3 based on this and this. Does anyone have a simple working example closer to my use case, which is saving content from the user's active tab to a SQLite database? Thanks.
The OPFS depends on the createSyncAccessHandle() method, which is exposed in Worker threads. The usual feature detection goes like this:
if (self instanceof WorkerGlobalScope && 'createSyncAccessHandle' in self.FileSystemFileHandle.prototype) {
// OPFS in `Worker` is supported!
}
Now an extension service worker (as currently implemented in Chrome) is an instance of ServiceWorkerGlobalScope, so the API is not supported there.
Unfortunately at the moment the only choice is to open an extension page and then run the OPFS code from there.

Connecting application to a single notebook in Evernote, supportLinkedSandbox parameter

I am trying to limit access to one nootebook using supportLinkedSandbox=true parameter as it is described here:
http://dev.evernote.com/doc/articles/app_notebook.php
It seems this paramerter has no effect on sandbox environment.
https://www.sandbox.evernote.com/OAuth.action?oauth_token=...]&preferRegistration=true&supportLinkedSandbox=true
What could be wrong?
In order to use supportLinkedSandbox=true, the notebook sandboxing feature needs to be enabled for a particular API key. You can request enabling this feature by writing to devsupport at evernote dot com.

No such interface 'org.freedesktop.DBus.Properties' on object at path /org/freedesktop/NetworkManager/ActiveConnection/

I start my qt application in the user's .profile file (not root) to make the app start on boot. Sometimes when my application start, it reports an warning as below:
"No such interface 'org.freedesktop.DBus.Properties' on object at path /org/freedesktop/NetworkManager/ActiveConnection/1"
I searched on google but did not find a explanation.
It seems my app is still working fine, but I want to locate the problem.
The application is running on ubuntu and using Qt5.
Thanks in advance.
Edit
I tried to debug dbus based on Eligijus Pupeikis's help with running:
gdbus introspect --system \
--dest org.freedesktop.NetworkManager \
--object-path /org/freedesktop/NetworkManager/ActiveConnection
it returns:
node /org/freedesktop/NetworkManager/ActiveConnection {
node 0 {
};
};
So, this means there is no such object just as the error message said, right?
And also, this gns3 team member says this problem is about Qt and Ubuntu.
Does this mean I don't need to solve it? I not familiar with the relationship between dbus and qt.
Most likely there is no such object "/org/freedesktop/NetworkManager/ActiveConnection/1" and because of that it can't find 'org.freedesktop.DBus.Properties' interface.
From documentation org.freedesktop.NetworkManager.Connection.Active :
Objects that implement the Connection.Active interface represent an attempt to connect to a network using the details provided by a Connection object. The Connection.Active object tracks the life-cycle of the connection attempt and if successful indicates whether the connected network is the "default" or preferred network for access. NetworkManager has the concept of connections, which can be thought of as settings, a profile or a configuration that can be applied on a networking device. Such settings-connections are exposed as D-Bus object and the active-connection expresses this relationship between device and settings-connection. At any time a settings-connection can only be activated on one device and vice versa. However, during activation and deactivation multiple active-connections can reference the same device or settings-connection as they are waiting to be activated or to be deactivated.
You can't know that that ActiveConnection object with specifically index 1 exists so you need to check by reading ActiveConnections property from /org/freedesktop/NetworkManager object's org.freedesktop.NetworkManager interface.
To have better visualize and understand how it looks I suggest D-Bus debugger. If you are using Gnome check out D-Feet.

Twain disable UI in DAT_USERINTERFACE, still show UI during scan

I'm trying to programmatically control a twain scanner within my custom application. I don't want to show the scanner's native UI.
I set CAP_INDICATORS capability to FALSE, and set CAP_UICONTROLLABLE capability to TRUE.
Then I start the scan using DG_CONTROL / DAT_USERINTERFACE / MSG_ENABLEDS, while ShowUI in TW_USERINTERFACE structure is set to FALSE.
I tested through different scanners. While my Epson DS-30 scanner is working as expected without ui, my Avision A6 scanner still shows a progress UI during scan:
This UI appears when I call DG_IMAGE / DAT_IMAGEINFO / MSG_GET operation, to get the image details from scanner. With DAT_IMAGEINFO command, this A6 scanner start to scan the paper, and after scanning complete, I could finally recieve the TW_IMAGEINFO structure.
I don't receive any TWRC_CHECKSTATUS while setting the UI mode.
So does this particular scanner actually doesn't support twain without UI?
Or could I have something workaround to disable this UI?
Actually a lot depends on the driver implementation.
So what happens is the options you set from the application configures the driver based on the capabilities it supports. If the driver capability for UI-less scanning is not allowed to be configurable by the driver in that case your application implementation may not work as expected.
Please refer to the TWAIN documentation for complete details.

FreePBX add a new SIP extension

I've successfully built VoIP server with FreePBX Asterisk. It works fine when I register a user on FreePBX. However, I would like to register a SIP account from mobile device directly. I found out that I can add custom information into FreePBX MySQL database.
However, it doesn't work either, and I couldn't find a place to insert SIP password.. Someone said that I need to do something with /var/www/html/admin/functions.inc.php file. Is there better way to create a new SIP extension from outside of FreePBX GUI? Thank you.
Freepbx not use database way(asterisk realtime).
Instead it use text file method.
After adding new info into mysql database, you have apply changes on web to write new config files. You can do same from command line interface (see amp_engine), but can't do that using db query.
Other option is use freepbx framework.php correctly.
Also you can use asterisk realtime architecture and not use freepbx dialplan.
WARNING Freepbx is designed for low number of extensions and low load(branch office pbx). As result using it for support mobile device application will be great fail. Check other projects, for example a2billing.org or hire expert to build core server with HA/failover for your need.

Resources