**** BEGIN LOGGING AT Sun Aug 06 03:00:01 2017 Aug 07 00:21:54 is it possible to make n900 lock the screen when i close hwkbd? Aug 07 00:34:14 Does it send a dbus signal when hwkbd is being closed? Aug 07 00:37:59 not sure, but it must send something since device wakes up when kbd is opened... Aug 07 00:38:42 i think i saw entries in syslog about hwkbd activated and deactivated Aug 07 00:39:06 slide open, slide closed actually... Aug 07 00:41:13 and actually n900 actually locks the screen if it is locked when i open kbd and close it, without touching screen Aug 07 00:50:52 from syslog "slide (GPIO 71) is now open" Aug 07 00:52:02 "slide (GPIO 71) is now closed" Aug 07 01:08:19 Yes, dbus-monitor --system reports platform_slide events too Aug 07 01:09:35 so i would need a script which trickers lock command when it sees slide closed, i guess Aug 07 01:10:22 no idea how to make one tho... Aug 07 01:11:50 You can always just poll the gpio node in sysfs. Aug 07 01:12:31 I suggest the dbus because there is dbus-scripts-settings in maemo repositories. Aug 07 01:14:02 Can just open the right /sys/devices/platform/gpio-switch/*/state file, read it, poll it for POLLPRI, repeat Aug 07 01:15:01 * Maxdamantus is guessing that would be simpler than anything involving dbus. Aug 07 01:18:50 * Oksana nods, but thinks that it would be nice to have something event-based, instead of polling the state every second or something Aug 07 01:19:16 * Oksana goes to read start-up scripts in /etc/something.d/ ; do they detect slide as event? Aug 07 01:22:29 Init scripts are an interesting field Aug 07 01:36:17 When I say "poll", I mean poll(2) Aug 07 01:36:41 The operation that waits for an event on a set of fds. Aug 07 01:38:15 dbus-script-settings has just keyboard slide option. Or should it be taken care on command "lock if unlocked and unlock if locked" Aug 07 01:40:25 fds? Waiting for an event sounds nice Aug 07 01:42:42 file descriptors Aug 07 01:43:18 If you're using Python, it seems like it should be simple enough using the `select` module thing. Aug 07 01:45:14 something like: f = open("/sys/..", "r"); while True: state = f.read(); poll = select.poll(); poll.register(f, select.POLLPRI); poll.poll(); f.seek(0); Aug 07 01:46:08 So you just detect when `state` changes from "open\n" to "closed\n" or whatever. Aug 07 01:49:52 Actually, don't need to create a `poll` object each iteration. Just register it outside of the loop then keep doing `state = f.read(); poll.poll(); f.seek(0)` Aug 07 01:50:21 Python seems to have a decent IO library. Aug 07 01:50:31 * Maxdamantus wishes it were also a decent language. Aug 07 01:56:27 u lost me Aug 07 02:00:04 What I'm saying is, you should be able to write something as simple as this: f = open("/sys/..", "r"); poll = select.poll(); poll.register(f, select.POLLPRI); while True: state = f.read(); print(state); poll.poll(); f.seek(0); Aug 07 02:00:35 which should print the state of the GPIO each time it's updated. Aug 07 02:00:49 Does poll.poll(); means wait-till-an-event-happens? Aug 07 02:00:52 Don't need dbus or anything fancy. Aug 07 02:01:12 Oksana: yes, so the process is doing nothing until that event occurs. Aug 07 02:01:14 Sounds short and simple. Is it doable in C? Aug 07 02:01:23 Yes. Aug 07 02:02:11 but at work atm, so not going to produce example C code. man 2 poll Aug 07 02:02:26 And the program will be idling in background all the time, but at least not using any resources/CPU... Aug 07 02:02:37 Indeed. Aug 07 02:03:04 What is already idling in the background and sending these dbus signals about slider being opened and closed? Aug 07 02:03:46 * Maxdamantus has a small C program that does something similar to skip songs in mpd when the shutter button is pressed. Aug 07 02:09:02 hmm i see. So i would c translator Aug 07 02:09:17 i'll see what i manage when i get back home Aug 07 02:29:06 what the heck are you talking about? dbus-scripting doesn't need polling Aug 07 02:30:53 Different things. dbus-scripts is one solution to detect keyboard-slide being closed, while polling is another (python example above, but just as doable in C). Aug 07 02:34:54 http://talk.maemo.org/showthread.php?t=48504 Aug 07 02:38:33 btw maemo,org cert invalid. talk.maemo.org search a total fail Aug 07 02:39:17 nevermind the second Aug 07 02:40:05 for locking screen just replace the aplay line in my playswoosh script by the according dbus call from phonecontrol Aug 07 02:40:48 err play-sound Aug 07 02:42:14 also you want to change "$slide == open" to "$slide == closed" Aug 07 02:43:02 or follow my original instructions as of >>for the screen locking on closing kbd slider you may want to add the "else" lines from above<< Aug 07 02:47:07 Oksana: dbus-monitor (and dbus-scripting) do wait for events. If they use poll() or another equivalent function for it I don't know and doesn't matter Aug 07 02:55:25 I suspect I'm missing parts of the convo, didn't see how init scripts came in, nor any polling script Aug 07 02:57:02 Question is, do dbus-scripts add an additional overhead, compared against a lower-level (?) polling of device state? Aug 07 02:59:06 you do not want to do any polling! that eats battery like mad. Poll() and select() have nothing to do with polling. You also can't use poll() in this context Aug 07 02:59:24 and no, dbus-scripting doesn't add any overhead **** ENDING LOGGING AT Mon Aug 07 03:00:02 2017