maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   The Other Half (https://talk.maemo.org/forumdisplay.php?f=59)
-   -   DIP_TOH -- lots of toggles! -- sold out! (https://talk.maemo.org/showthread.php?t=93350)

Koiruus 2014-09-17 21:26

Re: DIP_TOH -- lots of toggles! -- orders 14/19
 
Umm, seems like something is not working. I made the i2c tinkering stuff succesfully and installed the rpm and the daemon is running.

But, the dips seem unresponsive. tail -f /home/nemo/diplog just gives me:

/home/nemo/diptoh/dip4on.sh
/home/nemo/diptoh/dip5off.sh

No matter what switches I dip. And journalctl -f | grep diptoh doesn't give me any print. I tried reattaching the oh but without any success.

kimmoli 2014-09-17 21:31

Re: DIP_TOH -- lots of toggles! -- orders 14/19
 
journalctl as root.

Something has happened atleast, maybe.
Today i did use diptoh whole day without issues.

The gpio-expander is tricky, as it looses its config if it looses power.

I had to add some paper (2 layers of 80g) under the pcb (between 3dprint and pcb) for reliable contact. (<< dirkvl FYI)

If fails, just lift the toh few mm from the bottom left corner, to make the microswitch toggle.

dirkvl 2014-09-18 13:43

Re: DIP_TOH -- lots of toggles! -- orders 14/19
 
will adjust design

Koiruus 2014-09-18 17:21

Re: DIP_TOH -- lots of toggles! -- orders 14/19
 
Quote:

Originally Posted by kimmoli (Post 1439557)
journalctl as root.

Something has happened atleast, maybe.
Today i did use diptoh whole day without issues.

The gpio-expander is tricky, as it looses its config if it looses power.

I had to add some paper (2 layers of 80g) under the pcb (between 3dprint and pcb) for reliable contact. (<< dirkvl FYI)

If fails, just lift the toh few mm from the bottom left corner, to make the microswitch toggle.

Yep, something happens, but looks like it is not fully working. I did journalctl as root. But today I packed my Jolla and sent it to maintenance (accidental rebooting issues again), so I will try again when I get my phone back.

MemphisX 2014-09-20 02:35

Re: DIP_TOH -- lots of toggles! -- orders 14/19
 
I've received mine a few days ago but it was quite a busy week so I didn't have enough time to play with it. First impressions: toh is great, the whole finish seems really professional (thanks so much dirk) and kimmoli's work on the software side is just genious (just in the thought that with the press of a dip switch I can run my custom bash scripts...)

I had a few problems with the stability of it and it seems that somehow occasionally the pins lose contact with the board (or something else is happening) and so I have to take off toh and put it back again. After removing the board from toh and putting some stickers between (following the advice of paper suggested above by kimmoli) the issue seems to be appearing less frequently. I have noticed though that sometimes after turning on the first dip it works but any other change won't until I refit toh.

From the example scripts provided by kimmoli those for display do not work simply because there is no mcetool in my jolla (fixed by installing it with pkcon: "pkcon install mce-tools") instead I added a simple script for enabling/unmasking disabling/masking aliendalvik which is extremely handy:

For Masking/disabling:
Code:

systemctl stop aliendalvik.service
systemctl mask aliendalvik.service

and for unmasking/enabling:
Code:

systemctl unmask aliendalvik.service
systemctl start aliendalvik.service

of course if you don't want to completely prevent aliendalvik from starting you can remove the mask/unmask commands.

Now I wish I knew of a way for enabling/disabling the led flashlight from the command line....

Question: Do we need to keep i2ctool installed after we finish the initial process of setting up the diptoh?

kimmoli 2014-09-20 06:19

Re: DIP_TOH -- lots of toggles! -- orders 14/19
 
Quote:

Originally Posted by MemphisX (Post 1439779)
Now I wish I knew of a way for enabling/disabling the led flashlight from the command line....

Updated original list with flashlight sample: http://talk.maemo.org/showthread.php...80#post1439380

Also included aliendalvik sample (w/o masking) there. thanks.

Quote:

Originally Posted by MemphisX (Post 1439779)
Question: Do we need to keep i2ctool installed after we finish the initial process of setting up the diptoh?

No, it is not needed after programming eeprom.

cartron 2014-09-20 19:16

Re: DIP_TOH -- lots of toggles! -- orders 12/12
 
excellent, thanks for the examples Kimmo.
I will look and try to make a script to enable/disable wifi - will post it here if successfull.

cartron 2014-09-20 19:24

Re: DIP_TOH -- lots of toggles! -- orders 12/12
 
Quote:

Originally Posted by cartron (Post 1439869)
excellent, thanks for the examples Kimmo.
I will look and try to make a script to enable/disable wifi - will post it here if successfull.

that was easy, looking at /etc/connmain/main.conf gave a hint:
PreferredTechnologies = bluetooth,wifi,cellular

code for on:
Code:

dbus-send --system --print-reply --dest=net.connman /net/connman/technology/wifi net.connman.Technology.SetProperty string:"Powered" variant:boolean:true
code for off:
Code:

dbus-send --system --print-reply --dest=net.connman /net/connman/technology/wifi net.connman.Technology.SetProperty string:"Powered" variant:boolean:false

cartron 2014-09-20 21:19

Re: DIP_TOH -- lots of toggles! -- orders 12/12
 
Now what I'm looking for is a way to have a switch which says:

"On => switch radio to 4G"
"Off => switch radio to 2G"

That way I can have 2G when not using the screen, and when using the screen, I manually switch to 3G or 4G.

kimmoli 2014-09-20 21:30

Re: DIP_TOH -- lots of toggles! -- orders 14/19
 
Code:

dbus-send --system --print-reply --dest=org.ofono /ril_0 org.ofono.RadioSettings.SetProperty string:"TechnologyPreference" variant:string:"umts"
"any" for 4G
"umts" for 3G
"gsm" for 2G

cartron 2014-09-20 21:31

Re: DIP_TOH -- lots of toggles! -- orders 14/19
 
Quote:

Originally Posted by kimmoli (Post 1439885)
Code:

dbus-send --system --print-reply --dest=org.ofono /ril_0 org.ofono.RadioSettings.SetProperty string:"TechnologyPreference" variant:string:"umts"
"any" for 4G
"umts" for 3G
"gsm" for 2G

Awesome Kimmo!
Thanks!!!

Kabouik 2014-09-21 01:53

Re: DIP_TOH -- lots of toggles! -- orders 14/19
 
The switches still seem not to work here, though the scripts do work as intented if I manually run them with sh dipXon.sh as root in the terminal.

journalctl -f | grep diptoh finds no journal, or shows nothing (no error either) if run as root. And diplog shows nothing new (but there are some lines originating from my first few trials when the script were still default).

How can I check that the service is running/not conflicting with any other OH service?

kimmoli 2014-09-21 06:36

Re: DIP_TOH -- lots of toggles! -- orders 14/19
 
That sounds strange;

Quote:

Originally Posted by Kabouik (Post 1439910)
...How can I check that the service is running/not conflicting with any other OH service?

You can check service with systemctl status harbour-diptoh-daemon

To check what is running, ps -A | grep toh When diptoh is not attached, you should see this:
Code:

  95 ?        00:00:00 irq/331-toh-eve
  786 ?        00:00:03 tohd

If you have journalctl -f | grep toh running while attaching diptoh, what you see?

And you could try to add 2-3 layers of paper between the PCB and 3D print.
Just small ~10mm pieces to position where contacts are.

Or you can try to manually start the diptoh
systemctl start harbour-diptoh-daemon (open another ssh session to do this, or New Window from fingerterm) and keep that journal running on the other.)

Hope this helps.

Kabouik 2014-09-21 18:28

Re: DIP_TOH -- lots of toggles! -- orders 14/19
 
Thanks Kimmo.

Then, the service is running correctly. I had toholed running though, so I stopped it, disabled it, and I restarted diptoh but still no fortune when trying the switches again.

I already added two layers of papers between the PCB and the OH 3D print yesterday. :[

Here's what I get when attaching diptoh: http://hastebin.com/zuwapoqeyu.avrasm

Apparently there's something wrong with the EEPROM. That's weird because I did check that I entered the correct values when I used i2ctool, and after the first trials, the scripts where correctly echoing to diplog.

kimmoli 2014-09-21 18:43

Re: DIP_TOH -- lots of toggles! -- orders 14/19
 
Did you have prototype toholed? (my bad memory)
The new versions should not be running, only when it is actually attached, just like the diptoh

öh. Copied it here to easier commenting:

Sep 21 20:27:16 Jolla systemd[1]: Stopping Diptoh Other Half...

^ this is caused by opening the TOH microswitch (removing TOH), then it kills the daemon.
Sep 21 20:27:16 Jolla harbour-diptoh-daemon[791]: Received signal SIGTERM
Sep 21 20:27:16 Jolla harbour-diptoh-daemon[791]: vdd set to off
Sep 21 20:27:16 Jolla harbour-diptoh-daemon[791]: diptoh exiting, bye
Sep 21 20:27:16 Jolla systemd[1]: Stopped Diptoh Other Half.

^ daemon is now shutdown, but there is prints from daemon so it has been started at some point.
Sep 21 20:27:19 Jolla kernel: toh-core toh-core.0: No valid eeprom present
^ This occurs when TOH microswitch is pressed again, but there is no contact between toh pcb and phone.

If you try this when attaching toh: start from top, and while applying pressure to the area where PCB is (making sure there is contact) and bending the print a little (2-3mm) to make the microswitch-corner to be last to snap in.

(I have discussed with Jolla to add some retries/delay to the eeprom reading procedure)

Kabouik 2014-09-21 18:54

Re: DIP_TOH -- lots of toggles! -- orders 14/19
 
Yep I had prototype toholed, have I missed some new versions of the software?

Here's what happens when attaching the toh as you said:

# Here I just removed diptoh:
[root@Jolla nemo]# journalctl -f | grep toh
Sep 21 20:51:28 Jolla systemd[1]: Stopped Diptoh Other Half.


# And reattached it as you said:
Sep 21 20:52:13 Jolla kernel: platform toh-core.0: parent platform should not be sleeping
Sep 21 20:52:13 Jolla kernel: wakeup wake lock: tohd
Sep 21 20:52:13 Jolla kernel: active wake lock tohd
Sep 21 20:52:13 Jolla systemd[1]: Starting Diptoh Other Half...
Sep 21 20:52:13 Jolla systemd[1]: Started Diptoh Other Half.
Sep 21 20:52:13 Jolla harbour-diptoh-daemon[27420]: diptoh starting, yay. My version is 0.1
Sep 21 20:52:13 Jolla harbour-diptoh-daemon[27420]: vdd set to on
Sep 21 20:52:13 Jolla harbour-diptoh-daemon[27420]: mcp23009 initialized
Sep 21 20:52:13 Jolla harbour-diptoh-daemon[27420]: Worker started
Sep 21 20:52:13 Jolla harbour-diptoh-daemon[27420]: Write failed.
Sep 21 20:52:13 Jolla harbour-diptoh-daemon[27420]: Dips toggled: 111111
Sep 21 20:52:13 Jolla harbour-diptoh-daemon[27420]: Nothing actually changed
Sep 21 20:52:16 Jolla tohd[783]: timeout; terminating discovery


Switches seem to work now. :eek:
...
Well they stopped working 2 minutes later. :(

kimmoli 2014-09-21 19:01

Re: DIP_TOH -- lots of toggles! -- orders 14/19
 
Quote:

Originally Posted by Kabouik (Post 1439972)
Yep I had prototype toholed, have I missed some new versions of the software?

no, no updates for proto.sw

The journal you copied is ok.
That one "write error" is unknown, and i have it too.

Do you have all switches at position 1 (on) ?

And you dont see anything if toggling now?

Kabouik 2014-09-21 19:03

Re: DIP_TOH -- lots of toggles! -- orders 14/19
 
Yep, all were at position 1. First trials have worked (demo-mode, bluetooth, wlan), and then switches have stopped working (even those I cited).

kimmoli 2014-09-21 19:08

Re: DIP_TOH -- lots of toggles! -- orders 14/19
 
öö, so it works few times now? (or was this the first time you tried it and it worked?)

set all to OFF and reattach, does it show like this then
Sep 21 20:52:13 Jolla harbour-diptoh-daemon[27420]: Dips toggled: 000000
Sep 21 20:52:13 Jolla harbour-diptoh-daemon[27420]: Nothing actually changed

Kabouik 2014-09-22 12:44

Re: DIP_TOH -- lots of toggles! -- orders 14/19
 
Yes Kimmo, I edited the previous message (20:54) when I realized switches were working with the custom scripts! But it stopped working a few minutes later. I removed the diptoh and replaced it again the way you advised, and it works again. I guess it stopped working yesterday because of a bad contact, or because perhaps I moved two switches at the same time inadvertently? Would that be an issue if that happens? Considering that I have very short nails and that the switches are tiny, this can happen quite often. :)

Anyway, thanks for your very valuable help Kimmo!

kimmoli 2014-09-22 13:19

Re: DIP_TOH -- lots of toggles! -- orders 14/19
 
Quote:

Originally Posted by Kabouik (Post 1440016)
... or because perhaps I moved two switches at the same time inadvertently? Would that be an issue if that happens? Considering that I have very short nails and that the switches are tiny, this can happen quite often. :)

I haven't actually made such testing, but i assume no. It processes dips that changed in same interrupt in a for-loop, and processes are started as detached.
https://github.com/kimmoli/diptoh-da.../dips.cpp#L172

I think there is still contact issues. I had to reset it twice (just liftng that one corner few mm), specially if i have phone in my pocket.

Quote:

Originally Posted by Kabouik (Post 1440016)
Anyway, thanks for your very valuable help Kimmo!

You make my ancestors proud...

Kabouik 2014-09-22 16:11

Re: DIP_TOH -- lots of toggles! -- orders 14/19
 
You're right, I just checked after having carried the Jolla in my jean's pocket today, and the switches had stopped working again. Lifting up the bottom corner solved it.

I noticed that the switches had moved from "off" to "on" or the opposite while in my pocket, though I did not pick the Jolla from my pocket very often today (it was just sitting there in my pocket). That could be an issue to solve for future revisions of the diptoh (but future versions would need larger buttons or larger space between them anyway, to be more useable for people like me who have short nails). These pockets can be a bit tight though, that should be OK in almost every other pants I have.

Speaking of that, I'd appreciate any built-in system to help removing OHs for people who have no nails. I have to find a tool and slightly scratch my Jolla every time I must remove an OH (and I really have to, there is no way I can remove a custom OH with no tool; don't laugh at me). A small notch in future 3D prints, or small lever, or anything, I don't know.

I'm glad I made your ancestors proud! Now finish and ship some toheinks and you'll be the greatest offspring ever. :]

asys3 2014-09-22 18:36

Re: DIP_TOH -- lots of toggles! -- orders 14/19
 
First of all:
Thanks kimmoli and dirk for both hard- and software developing for the DIPTOH - really great!!!!

I'm doing some experiments with different calls at the moment and came to one point:


Is it possible to check the position of a switch?

If I don't miss anything we do it the other way round: using a switch calls a script.

Can we also read out the positions of all switches?

asys3

kimmoli 2014-09-22 18:45

Re: DIP_TOH -- lots of toggles! -- orders 14/19
 
Quote:

Originally Posted by asys3 (Post 1440058)
If I don't miss anything we do it the other way round: using a switch calls a script.

Yes, toggling the switch causes interrupt, which tells daemon to read switch states from gpio expander over i2c.
Daemon them compares read states to previous states, and executes a specified script of state which really changed.

Quote:

Originally Posted by asys3 (Post 1440058)
Is it possible to check the position of a switch?
...
Can we also read out the positions of all switches?

Not at the moment, but I can add e.g. dbus interface to check the current state? or write them to a file e.g. /tmp/dipswitchstate when ever they change.

To prevent the whole diptoh to die after single connection break, i think i will add timer to periodically check and re-init gpio expander if needed.

haliava 2014-09-25 09:09

Re: DIP_TOH -- lots of toggles! -- orders 14/19
 
Eh, and what's about the button? Where is the area, how should it be pressed and whether there'll be capability to run a script on this interrupt as well?

kimmoli 2014-09-25 09:28

Re: DIP_TOH -- lots of toggles! -- orders 14/19
 
Quote:

Originally Posted by haliava (Post 1440475)
Eh, and what's about the button? Where is the area, how should it be pressed and whether there'll be capability to run a script on this interrupt as well?

It is located below DIP-switch, you can see the void in bottom copper of PCB, about there.

Not yet implemented in the daemon though. Update coming, ETA 12 hours

dirkvl 2014-09-25 15:49

Re: DIP_TOH -- lots of toggles! -- orders 14/19
 
tomorrow the last shells arrive, then the last ones go on the mail!

kimmoli 2014-09-25 20:31

Re: DIP_TOH -- lots of toggles! -- orders 14/19
 
OBSOLETE

http://talk.maemo.org/images/icons/icon2.gif Update 0.4-1

Download RPM here: https://app.younited.com/?shareObjec...9-7726d2d559f0

Update will not overwrite your dip*.sh scripts (but make a back e.g. tar czvf diptoh.tgz /home/nemo/diptoh/ just to be sure)
  • Adds two scripts,. buttondown.sh and buttonup.sh these will be run when the secret button is pressed and released.
  • Checks every 30 sec has diptoh been disconnected. In case this is detected, chip will be reinitialized.
  • It also improves the interrupt and gpio handling - there was few issues in case of switch-bouncing etc.

haliava 2014-09-26 12:28

Re: DIP_TOH -- lots of toggles! -- orders 14/19
 
Quote:

Originally Posted by kimmoli (Post 1440568)

Interesting, after installing this and rebooting the phone - there's something wrong with it. Gui can't connect - frequent green flashes with screen blank after the initial boot sequence. Guess will factory reset from recovery and try again - as I don't think I have patience/time to troubleshoot in shell not really understanding what could go wrong.
Or does someone have a better idea?

kimmoli 2014-09-26 12:36

Re: DIP_TOH -- lots of toggles! -- orders 14/19
 
Quote:

Originally Posted by haliava (Post 1440656)
Interesting, after installing this and rebooting the phone - there's something wrong with it. Gui can't connect - frequent green flashes with screen blank after the initial boot sequence. Guess will factory reset from recovery and try again - as I don't think I have patience/time to troubleshoot in shell not really understanding what could go wrong.
Or does someone have a better idea?

argh. that doesn't sound nice at all. I make quick reboot and test it myself. iirc i did reboot-test it atleast once.

This shouldn't happen if diptoh is not attached to phone, as it is not started in that case.

-------

:mad: Ok, seems that during reboot, it gives sporadic interrupt, at first reboot it did execute dip1on and dip1off, and on 2nd boot only dip1on.

I raise an issue to me about this, and try to fix it asap (ETA 5 hours)

haliava 2014-09-26 12:52

Re: DIP_TOH -- lots of toggles! -- sold out!
 
Well, for me it doesn't boot with whatever OH (or not any) is attached.

kimmoli 2014-09-26 15:07

Re: DIP_TOH -- lots of toggles! -- sold out!
 
http://talk.maemo.org/images/icons/icon2.gif Update 0.5-1

RPM here https://app.younited.com/?shareObjec...3-3f69e7ababe1

Changes:
  • Clear interrupts before enabling gpio-int. (Prevents scripts from running at start/reboot.)

haliava 2014-09-26 16:26

Re: DIP_TOH -- lots of toggles! -- sold out!
 
Quote:

Originally Posted by kimmoli (Post 1440678)

Anything I could do from recovery shell to restore device to bootable state - or is the factory reset my only option? :)

kimmoli 2014-09-26 16:57

Re: DIP_TOH -- lots of toggles! -- sold out!
 
Quote:

Originally Posted by haliava (Post 1440685)
Anything I could do from recovery shell to restore device to bootable state - or is the factory reset my only option? :)

I was wondering what kind of scripts you had there? I did notice some strange behaviour once during development, as i did trigger all 6 scripts at once - after that mobiledata was completely disabled until reboot. (i have my example-scripts 1..4, and soundplaying-one)

but... it is really hard to say what could gone wrong there.. the daemon itself does not write anything anywhere, except to
/sys/class/gpio/export
/sys/class/gpio/gpio67/...
/sys/devices/platform/reg-userspace-consumer.0/state

That updated version uses libiphb (compiled within) but i use exactly same stuff in toholed.

I will seek advisory from irc

kimmoli 2014-09-26 17:13

Re: DIP_TOH -- lots of toggles! -- sold out!
 
https://together.jolla.com/question/...#post-id-22127

http://talk.maemo.org/showthread.php...99#post1428999

haliava 2014-10-01 15:09

Re: DIP_TOH -- lots of toggles! -- sold out!
 
Well, only factory reset helped. Now after installing the latest version phone behaves fine - though it doesn't look like daemon is working. Scripts do not seem to activate, and there are also no records in journal. My EEPROM is supposed to be programmed - as oh was shipped out after the related post.
So kimmoli, probably will need to have a lunch with you for troubleshooting.

kimmoli 2014-10-01 15:23

Re: DIP_TOH -- lots of toggles! -- sold out!
 
Quote:

Originally Posted by haliava (Post 1441391)
So kimmoli, probably will need to have a lunch with you for troubleshooting.

Ok for me :cool:

evk 2014-10-09 10:02

Re: DIP_TOH -- lots of toggles! -- sold out!
 
Got mine. I thought that it'd be mostly a novelty due to dip beeing slightly fiddly, but it's very usable. Now we only need more apps with dbus-interfaces.

Only problem is that can't use it toghether with the lastu case.

MemphisX 2014-10-26 00:28

Re: DIP_TOH -- lots of toggles! -- sold out!
 
Is it only me or after the latest Jolla update (1.1.0.38) the DIP_TOH stopped working?

Kabouik 2014-10-27 17:13

Re: DIP_TOH -- lots of toggles! -- sold out!
 
It still works for me. However, it stops working every few days with no apparent reason, I have to remove it and reinstall it to make it work again, which is terrible for me as I my nails are not long enough to remove an OH. :)

More importantly, I'm not sure it is related to the diptoh but let's throw it just in case someone experienced the same thing: I lose network (phone and data) several times a day approximately since I use diptoh. Sailfish utilities to restart network does not help, nor does my diptoh script to switch from 3/4G to 2G. Not more success with the flight mode toggle. I lose network in areas where there is good coverage, be it 2G, 3G or 4G, and in several distant locations (I moved like 800 km last week and the problem occurred in all areas). There is not necessarily a notification for the error, just the phone network gauge displayed as empty and no data connection indicator. Only rebooting helps solving the issue (instantly). Is it possible that it is related to the diptoh? I would happily test that by using toholed for a few weeks but it doesn't offer the update when I plug it and I have no time right now to investigate why. And there is no way I will put a regular OH on my Jolla. :)


All times are GMT. The time now is 15:35.

vBulletin® Version 3.8.8