Project

General

Profile

Actions

Feature #1201

open

Add Pairing apps to launcher in imrest

Added by Hammel about 1 month ago. Updated about 18 hours ago.

Status:
In Progress
Priority:
Immediate
Assignee:
Category:
Core platform
Target version:
Start date:
01 Apr 2025
Due date:
% Done:

90%

Estimated time:
Severity:
01 - Critical

Description

The launcher should allow enabling of pairing devices on Ironman. This would allow removal of the GPIO hardware hack.

The pairing feature needs to be dynamically loaded into the status bar and a touch on it's icon sends an IPC message to imrest to enable pairing.


Related issues

Blocked by launcher - Feature #1202: Add support for dynamically loading features.ClosedHammel01 Apr 2025

Actions
Actions #1

Updated by Hammel about 1 month ago

  • Blocked by Feature #1202: Add support for dynamically loading features. added
Actions #2

Updated by Hammel 28 days ago

  • Subject changed from Add Pairing feature as an add-on to launcher to Add Pairing apps to launcher in imrest
  • Severity changed from 02 - High to 01 - Critical

imrest needs a simple app (binary or script) that is run via the launcher's status bar to toggle pairing mode.

The app will contact imrest via a UNIX_DOMAIN socket. The contact will enough to toggle the current state.
The app will then need to update the status bar icon. This will need to be done by one of the following methods.
  • Change a symlink between active and inactive icon for pairing
  • Change app config by notifying launcher via a UNIX_DOMAIN socket to swap the active icon.

The former is simpler but lacks synchronization. No synchronization requires the launcher to poll icons for changes or schedule status bar updates.
The latter is more complex but is synchronized. Synchronization will allow the launcher to update the icon on notification.

I also need icons for active and inactive states for the pairing mode. The icons should be installed to /etc/launcher/icons.
I also need an xml config for the app that is installed to /etc/launcher/.statusbar.

Actions #3

Updated by Hammel 25 days ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 10

I think it would be simpler to just create a shared memory segment. That way I can open the reader in imrest and watch for updates and the app would just be imrest with a special command line option that messages the server version of imrest and updates the icon in the launcher.

videoe has inotify setup and a thread for notification that is must about the same thing - it doesn't care about what the notification is.

Actions #4

Updated by Hammel 24 days ago

  • % Done changed from 10 to 50

I opted for a UNIX_DOMAIN socket. It's now implemented in imrest and I've made imrest act as an launcher status bar app when run as imrest-app. This compiles cleanly but needs testing on hardware.

It also still needs a launcher app.xml added to the packaging.

Actions #5

Updated by Hammel 24 days ago

  • % Done changed from 50 to 60

xml file added. Just need testing now.

Actions #6

Updated by Hammel 23 days ago

  • % Done changed from 60 to 70

It mostly worked but there was a bug. I've fixed the bug and tested imrest-app manually and it seems to work. Now I need to retest on hardware.

Actions #7

Updated by Hammel 22 days ago

Touches are not always working in the status bar. Also, when the touch does work and imrest-app is called, nothing happens.

iconTouchGTK[launcher.c:202] INFO Processing touch request.
iconTouchGTK[launcher.c:215] INFO Status Bar Index: 1
touchProcessor[touchProcessor.c:380] INFO TSLIB: sample 1745374360.777265:    749      4    255
touchProcessor[touchProcessor.c:382] INFO TSLIB: last   1745374360.537276:    750      4    255
touchProcessor[touchProcessor.c:394] INFO 1. diff.sec: 0  -- diff.usec: 239989
touchProcessor[touchProcessor.c:397] INFO --- Skipping fast repeat
touchProcessor[touchProcessor.c:376] INFO TSLIB: not pressed.
notify[launcher.c:871] INFO Command to run: /usr/bin/imrest-app
$ tail -f /tmp/imrest.log
initSetup[init.c:56] INFO init.setup has been called.
initSetup[init.c:75] INFO Webroot directory : /home/httpd/imrest
initSetup[init.c:76] INFO Ironman directory : /home/httpd/imrest/ironman
initSetup[init.c:77] INFO Monitor directory : /home/httpd/imrest/monitor
initSetup[init.c:78] INFO Stamp directory   : /home/httpd/imrest/ironman/jarvis/
initSetup[init.c:79] INFO IoT directory     : /home/httpd/imrest/ironman/iot/
initSetup[init.c:80] INFO Descriptor file   : /home/httpd/imrest/monitor/descriptor
initSetup[init.c:82] INFO Monitor UUID      : 827dce7d-d536-4599-a26e-6989c7a8fbe0
main[imrest.c:348] INFO Running from /home/httpd/imrest.
startWatcherProcessor[watcher.c:224] INFO imrest: Started watcher thread.

It looks like when

/usr/bin/imrest-app

is called the app doesn't realize it's being called AS the app and tries to run the full imrest server again. I probably need to use basename() on arg0 to fix that.

Actions #8

Updated by Hammel 22 days ago

  • % Done changed from 70 to 90

Looks like it's working now.

$ /usr/bin/imrest-app 
Config file tag: verbose
Config file tag: debugfile
Verbosity level: 3
$ cat /tmp/imrest.log 
main[imrest.c:314] INFO Log file: /tmp/imrest.log
main[imrest.c:326] INFO Running as the app.
pairApp[pair-app.c:75] INFO Current icon: /etc/launcher/icons/imrest-off.png
pairApp[pair-app.c:80] INFO Current basename: imrest-off.png
pairApp[pair-app.c:81] INFO IMREST_PAIR_ON: imrest-on.png
pairApp[pair-app.c:82] INFO IMREST_PAIR_OFF: imrest-off.png
pairApp[pair-app.c:93] INFO Setting pairing to ON.
pairApp[pair-app.c:106] INFO symlink /etc/launcher/icons/imrest-on.png /etc/launcher/icons/imrest.png
pairApp[pair-app.c:142] INFO Pairapp is exiting.

The only thing left is to check the touch presses from launcher and the icon updates.

Actions #9

Updated by Hammel 21 days ago

One last thing: On reboot the imrest-app needs to be called to disable pairing, so we always start in non-pair mode.

Also, imrest itself should reset the state when it restarts. The server is the last word on the current state.

Actions #10

Updated by Hammel 20 days ago

Reset function implemented. Just needs to be tested on hardware. Currently running lockup test, however, which needs to run for a day or so.

Updated package is installed on hardware - just need to enable pairing and then reboot to make sure it comes back in non-pair mode.

Actions #11

Updated by Hammel 1 day ago

After testing that reboot comes back in non-pair mode, verify pairing actually works when enabled via the launcher.

Actions #12

Updated by Hammel about 18 hours ago

Not working.
  • reboot -f: doesn't clean up so on restart it's got the wrong icon and doesn't work to start/stop pairing.
  • imrest: goes 25% cpu load when pairing enabled. Without pairing it is at 0% cpu load.
  • icon off: imrest does not reset from 25% cpu load

If "reboot" alone is used, then the icons are okay because init script shutdown cleans up.
Probably need to have init script always reset on start. Maybe by using imrest-app to simply clean up, ie. via command line argument.

Actions

Also available in: Atom PDF