Tiny Core Linux

Tiny Core Extensions => TCE Bugs => Topic started by: chattrhand on February 23, 2019, 10:44:24 AM

Title: TCE 10.0 32bit, flit.tcz, Lenovo b4030
Post by: chattrhand on February 23, 2019, 10:44:24 AM
Hi TinyCore Team,

I actually find that  flit.tce  does not work as it should:
It shows a red frame around the battery symbol but no more charging %.

-rw-rw-r--    1 tc       staff        20480 Jan 23 10:50 flit.tcz   working fine

-rw-rw-r--    1 tc       staff        12288 Feb 22 18:33 flit.tcz   no charging %

By the way: when changing the settings of flit, i.e. clock in 24/12 h mode
or showing the Speaker symbol or change the volume % and Save Configuration
I find the new settings within  .flit.conf  but it will not be restored after next reboot.

Thank you in advance
chattrhand
Title: Re: TCE 10.0 32bit, flit.tcz, Lenovo b4030
Post by: Rich on February 24, 2019, 10:12:01 PM
Hi chattrhand
Quote
-rw-rw-r--    1 tc       staff        20480 Jan 23 10:50 flit.tcz   working fine
When you say "working fine", is that under TC10 or an older version of Tinycore?

Quote
By the way: when changing the settings of flit, i.e. clock in 24/12 h mode
or showing the Speaker symbol or change the volume % and Save Configuration
I find the new settings within  .flit.conf  but it will not be restored after next reboot.
If you quit flit and restart flit does it then pick up the settings?
Title: Re: TCE 10.0 32bit, flit.tcz, Lenovo b4030
Post by: NewUser on February 25, 2019, 01:24:51 AM
Hi chattrhand
Quote
-rw-rw-r--    1 tc       staff        20480 Jan 23 10:50 flit.tcz   working fine
When you say "working fine", is that under TC10 or an older version of Tinycore?

Quote
By the way: when changing the settings of flit, i.e. clock in 24/12 h mode
or showing the Speaker symbol or change the volume % and Save Configuration
I find the new settings within  .flit.conf  but it will not be restored after next reboot.
If you quit flit and restart flit does it then pick up the settings?
I just tried, and flit does not pick up the settings.
Title: Re: TCE 10.0 32bit, flit.tcz, Lenovo b4030
Post by: Rich on February 26, 2019, 12:53:00 AM
Hi Juanito
There's a newer version of flit (ver 1.3) with ALSA support located here:
https://sites.google.com/site/lockmoorecoding/downloads/flit
Title: Re: TCE 10.0 32bit, flit.tcz, Lenovo b4030
Post by: Rich on February 26, 2019, 09:21:58 AM
Hi Juanito
Unless I'm mistaken, the version of flit you compiled came from github:
https://github.com/tinycorelinux/fltk_projects/tree/master/flit
which appears to be a very old version (0.9.4). The source for the most recent version (1.3.1) is located in:
http://repo.tinycorelinux.net/3.x/tcz/src/flit/
Title: Re: TCE 10.0 32bit, flit.tcz, Lenovo b4030
Post by: chattrhand on February 26, 2019, 10:43:07 AM
Hi TinyCore team,

Now I think I have found the reason in the changelog of flit.tcz and a workaround.

The recent version flit 1.3.1 had been updated in 2011.
In 2013 it had been recompiled for tc 5.x.
In 20190129 it had been recompiled for fltk 1.3

So the re-compiled flit.tce has the same version number 1.3.1 but is obviously different (the newer one is even smaller !) but does not work for my old Lenovo b4030.

My workaround:
The TinyCore boot manager allows to handle "many" frugal  installations on the same stick, even of different versions.
Every installation needs a   /boot/core.gz   plus   /boot/vmlinuz   plus   /optional   directory of its own with the appropriate versions of its extensions. (and the boot select file   /boot/extlinux/extlinux.conf   must have the links to them)

- So start a "fresh" TinyCore 10.0 installation. First install alsa-config.tcz and alsa.tcz.
 
- In the ATerm open  $ alsamixer  and check that the Master is set to  41% volume.
  With  $ mkdir /opt/alsa  you add the alsa directory

- Copy the flit.* out of a known good tce9.0 installation to a tce/ installation:
  $ cp -a /mnt/sdb1/tce9.0Bank/optional/flit.*  /mnt/sdb1/tce/optional

- Now start the AppsBrowser, Select "Load Apps Locally" and find "flit.tcz"
  Mark it and click on "Load".

- In your   /home/tc/.X.d/autostart   add the three lines

[ $(which flit) ] && flit &
sleep 1s
speaker-test -c2 -t wav -l1

- Restart with Backup. Then you should hear the famous "front-left-front-right".
  and flit should appear at "south-east" with Battery Monitor, speaker and Time.

Title: Re: TCE 10.0 32bit, flit.tcz, Lenovo b4030
Post by: Rich on February 26, 2019, 03:10:22 PM
Hi chattrhand
Quote
Now I think I have found the reason in the changelog of flit.tcz and a workaround.
The change log lists the intended change, but not what really happened.

Quote
In 2013 it had been recompiled for tc 5.x.
I fetched  flit  from both the TC5 and TC9 repos. Right clicking on the  flit  applet and selecting  About  returned version 1.3.1
in both cases.

Quote
In 20190129 it had been recompiled for fltk 1.3
True. Running  ldd  on the executable confirmed that. Right clicking on the  flit  applet and selecting  About  returned version 0.9.4.

Quote
So the re-compiled flit.tce has the same version number 1.3.1 ...
Only according to the  .info  file. Look at my previous statement, the program will tell you otherwise.

Quote
...  but is obviously different (the newer one is even smaller !) but does not work for my old Lenovo b4030.
Part of that reduced size is because the  usr/share/doc/flit/flit_help.htm  file was omitted.
Title: Re: TCE 10.0 32bit, flit.tcz, Lenovo b4030
Post by: Juanito on February 27, 2019, 01:08:21 AM
..which appears to be a very old version (0.9.4). The source for the most recent version (1.3.1) is located in...

recompiled for tc-10.x x86 and posted - please report if it works as expected.
Title: Re: TCE 10.0 32bit, flit.tcz, Lenovo b4030
Post by: Rich on February 27, 2019, 01:47:25 PM
Hi Juanito
Since I tried it on a desktop I can't comment on the battery function. The clock and speaker functions work. The  Help  function
has a small issue. The path for the help file is defined in  flit.cpp  as:
Code: [Select]
#define PATH_TO_FLIT_HELP "/usr/share/doc/tc/flit_help.htm"but is located in the  .tcz  file at:
Code: [Select]
usr/local/share/doc/flit/flit_help.htm
Not an issue, just a note to other ALSA users. Flit could not control the volume because it mistakenly set the following
value in  .flit.conf:
Code: [Select]
# OSS/ALSA sound control name to use, autosel means 'try to pick for me'
sound_control_name = Master
In my particular case it should have been:
Code: [Select]
# OSS/ALSA sound control name to use, autosel means 'try to pick for me'
sound_control_name = PCM
If unsure, start  alsamixer  or  alsaguimixer  and see which slider controls the volume. The name listed under the slider
is the name to use, which in my case was PCM.
Title: Re: TCE 10.0 32bit, flit.tcz, Lenovo b4030
Post by: chattrhand on February 27, 2019, 04:38:11 PM
Hi Juanito

I replaced the older version of flit with the new one you recompiled and its almost fine.
This places a new "cOre" icon into the wBar and the battery meter seems to be ok.

The  /home/tc/.X.d/autostart  script places  flit  at "southeast", with battery and clock mode "PM/AM", but neither sound icon nor audible sound check.

Only after  "Exit to Prompt"  and  startx  the sound check is audible and flit is set according to  .flit.conf

Thats a workaround.
Title: Re: TCE 10.0 32bit, flit.tcz, Lenovo b4030
Post by: Juanito on February 28, 2019, 01:17:30 AM
The  Help  function has a small issue...
Path to help file adjusted in Makefile

Quote
Flit could not control the volume because it mistakenly set the following
value in  .flit.conf...
As long as I change .asoundrc to use analogue as the default as opposed to hdmi, then leaving "Master" as the .flit.conf default works for me.

Recompiled flit posted
Title: Re: TCE 10.0 32bit, flit.tcz, Lenovo b4030
Post by: Rich on February 28, 2019, 04:17:24 PM
Hi Juanito
Downloaded and tried (under TC9) the updated extension and it appears fine.
Title: Re: TCE 10.0 32bit, flit.tcz, Lenovo b4030
Post by: Rich on February 28, 2019, 04:48:03 PM
Hi chattrhand
Try changing this line in your  autostart  script from:
Code: [Select]
[ $(which flit) ] && flit &to:
Code: [Select]
[ $(which flit) ] && flit > ~/flit.txt &Reboot the machine and see if there are any messages in  flit.txt.
Title: Re: TCE 10.0 32bit, flit.tcz, Lenovo b4030
Post by: Juanito on March 01, 2019, 02:18:16 AM
Thanks - updated in the x86_64 repo as well
Title: Re: TCE 10.0 32bit, flit.tcz, Lenovo b4030
Post by: chattrhand on March 04, 2019, 09:25:57 AM
Hi Juanito, Rich,
Now I have built a fresh tinycore 10.0 installation, and

1.  install  alsa-config.tcz

2.  install  alsa.tcz

3.  start  $ alsamixer  to see that Master is set  (to 41 or -20dB)

4.  close it with Esc

5.  sound-check with  $ speaker-test -c2 -t wav - l1  to hear "front-left-front-right"

This five steps *must* be done first and in this sequence.

The next two steps i've omitted:
6.  $ sudo alsactl store
7.  alsactl restore  added to  /opt/bootlocal.sh
That had worked well for earlier versions up to tinycore 9.0, but no effect for tinycore 10.0

8.  install  flit.tcz

9.  Build a new   /home/tc/.X.d/autostart   containing:
    (omit or modify the two sleep commands)
 
# /home/tc/.X.d/autostart
sleep 1
[ $(which flit) ] && flit > ~/flit.txt &
sleep 1
speaker-test -c2 -t wav -l1 &

10. save and Reboot

11. The new session shows the flit at lower right corner:
    battery indicator is active,
    missing speaker symbol,
    time display in AM/PM mode,
    no soundcheck audible.

12. Click on  (*)Exit to Prompt  and OK  and you can read:

Speaker-test 1.1.5

Playback device is default
Stream parameters are 48000 Hz, S16_LEm 2 channels
no sound found
Playback open error: -2 No such file or directory

13. Type   startx   and Enter to restart the session.
    Now you hear the soundcheck and see  flit  fully working.

14. Or you do it step by step: click on flit and close it by its menu, re-open it by its wBar icon.
    Open the terminal and enter  $ speaker-test -c2 -t wav -l1 &

15. In the flit menu you also can save the last settings in ~/flit.conf
    This table has no variable for volume settings.
   
This is my workaround for alsa sound and flit on TC 10.0

And yes, the flit.tcz version for TC 9.0 works for TC 10.0 too.

thanks for your help
Title: Re: TCE 10.0 32bit, flit.tcz, Lenovo b4030
Post by: Rich on March 04, 2019, 09:33:51 AM
Hi chattrhand
Here's the problem:
no sound found
Playback open error: -2 No such file or directory
For whatever reason, the sound system isn't ready.

Quote
# /home/tc/.X.d/autostart
sleep 1
[ $(which flit) ] && flit > ~/flit.txt &
sleep 1
speaker-test -c2 -t wav -l1 &
Try increasing the first sleep command to see if it's timing related.
Title: Re: TCE 10.0 32bit, flit.tcz, Lenovo b4030
Post by: Juanito on March 05, 2019, 01:07:23 AM
no sound found
Playback open error: -2 No such file or directory

Is it possible that you have more than one sound device, for example hdmi and analogue, and the default could change on reboot?

For me, if hdmi comes up as default, flit will not find any sound device. If analogue comes up as default, things work fine.

One other thing I have noticed is that if the sound volume is adjusted via flit, it is not saved and reverts to the default volume on reboot.
Title: Re: TCE 10.0 32bit, flit.tcz, Lenovo b4030
Post by: Rich on March 05, 2019, 09:09:11 AM
Hi Juanito
... One other thing I have noticed is that if the sound volume is adjusted via flit, it is not saved and reverts to the default volume on reboot.
Wouldn't adding  alsactl store  to  shutdown.sh  fix that?
Title: Re: TCE 10.0 32bit, flit.tcz, Lenovo b4030
Post by: Rich on March 05, 2019, 10:54:24 PM
Hi Juanito
... One other thing I have noticed is that if the sound volume is adjusted via flit, it is not saved and reverts to the default volume on reboot.
I worked out the code for saving and restoring the volume if you are interested. There is one caveat however. I think there's a
truncation error in the volume calculations. Place the mouse cursor over flits speaker symbol and wait for the tool tip to pop up
with the current volume level. Using the mouses scroll wheel, alternate one click up, one click down, one click up, etc. You'll
see the volume level takes larger steps going down than going up. The error gets smaller as the volume level drops. It appears
to be caused by converting 0 to 100 volume levels to the mixers 0 to 31 scale and back again. Set versus read back values
look like this:
Code: [Select]
Set   Read
100    100
 90     87
 80     77
 70     67
 60     58
 50     48
 40     38
 30     29
 20     19
 10      9
  0      0
Title: Re: TCE 10.0 32bit, flit.tcz, Lenovo b4030
Post by: Juanito on March 07, 2019, 01:01:18 AM
Using the mouses scroll wheel, alternate one click up, one click down, one click up, etc.

I didn't realise you could do that - this thing is smarter than it looks  :)
Title: Re: TCE 10.0 32bit, flit.tcz, Lenovo b4030
Post by: Juanito on March 07, 2019, 05:58:13 AM
flit updated to latest version in tinycore git
Title: Re: TCE 10.0 32bit, flit.tcz, Lenovo b4030
Post by: Rich on March 08, 2019, 01:52:36 AM
Hi Juanito
If you're interested in trying it, I've attached a patch to update flit. Changes are:
1. Sound volume is now saved when you click on  Save configuration.
2. ALSA Audio level calculations rewritten to round instead of truncate.
3. Lowered the volume stepsize to better fit ALSAs 5 bit (0-31) volume level range.

Here are the changes if anyone wants to scroll through them:
Code: [Select]
--- flit.cpp.old 2019-03-05 11:52:44.186716596 +0000
+++ flit.cpp 2019-03-08 01:27:08.107952046 +0000
@@ -1,5 +1,13 @@
 // flit.cpp -- Flit is a "tray" with clock, sound, and battery applets
 
+// Version 1.3.2 Added: saved_volume variable
+// Updated: get_config and save_config to allow saving and restoring
+// volume level between sessions.
+// Rewrote: ALSA and newvol Audio level calculations to round instead of truncate.
+// Old versions are commented out with //RR, new versions in following line.
+// Updated: Lowered volume stepsize to 3% from 5% in do_sound_adj to fit better in
+// ALSAs 5 bit (0-31) volume level range.
+
 // Version 1.3.1 - M. Losh - Fix to make file to preserve root perms in /usr when installed   
 
 // Version 1.3.0 - M. Losh - Released with changes to default values of custom colors
@@ -114,7 +122,7 @@
 #define MIN(a, b)   (((a) < (b)) ? (a):(b))
 #endif
 
-#define APP_VER "1.3.1" // Last update 2011-07-23
+#define APP_VER "1.3.2" // Last update 2019-03-08
 #define PROG    "flit"
 #define METER_W     28
 #define SOUND_W     28
@@ -135,6 +143,9 @@
 const char *argp_program_version = PROGNAME_VERSION;
 const char *argp_program_bug_address = "<mlockmoore@gmail.com>; <jbysewski@googlemail.com>";
 
+// Volume level saved in config file.
+int saved_volume = -1;
+
 // This structure is used by main to communicate with parse_opt
 struct arguments
 {
@@ -803,7 +814,8 @@
                             rvol = v;
                         }
                         if (lvol >= 0 && rvol >= 0 && (mix_max > mix_min)) {
-                            pct = (int)(((float)(rvol + lvol)) * 100.0 / (2.0 * (float)(mix_max - mix_min)));
+//RR                            pct = (int)(((float)(rvol + lvol)) * 100.0 / (2.0 * (float)(mix_max - mix_min)));
+ pct = (int)(roundf(((rvol + lvol) * (100.0 / ((float)(mix_max - mix_min) * 2.0)))));
 #ifdef DIAG
                             printf("Sound level is %d %%\n", pct);
 #endif
@@ -826,7 +838,11 @@
             oss_mixer_value vr;
             int newvol;
             int intended;
-            newvol = (int)((float)(vol * mix_max) / 100.0) - mix_min;
+//RR            newvol = (int)((float)(vol * mix_max) / 100.0) - mix_min;
+            newvol = (int)(roundf((vol * ((float)(mix_max - mix_min) / 100.0))));
+#ifdef DIAG
+            printf("vol=%d newvol=%d mix_max=%d mix_min=%d\n", vol, newvol, mix_max, mix_min);
+#endif
             if (sound_type == SOUND_TYPE_OSS && mixer_fd && mix_ctrl) {
                 info.dev = 0;
                 info.ctrl = mix_ctrl;               
@@ -908,7 +924,8 @@
                         }
                     }
                     if (lvol >= 0 && rvol >= 0 && (mix_max > mix_min)) {
-                        actual_pct = (rvol + lvol) * 100.0 / (2.0 * (mix_max - mix_min));
+//RR                        actual_pct = (rvol + lvol) * 100.0 / (2.0 * (mix_max - mix_min));
+ actual_pct = (int)(roundf(((rvol + lvol) * (100.0 / ((float)(mix_max - mix_min) * 2.0)))));
 #ifdef DIAG
                         printf("Sound level after change is actually %d %%\n", actual_pct);
 #endif
@@ -1255,12 +1272,12 @@
             vol = sound_p->value();
             if (direction < 0) {
                 prev_sound_vol = vol;
-                vol -= 5;
+                vol -= 3;
                 if (vol < 0) vol = 0;
             }
             else if (direction > 0) {
                 prev_sound_vol = vol;
-                vol += 5;
+                vol += 3;
                 if (vol > 100) vol = 100;
             }
             else {
@@ -1427,6 +1444,14 @@
 #endif
                         
                     }
+                    else if (1 == sscanf(confline, "sound_volume_level = %d\n", &n)) {
+#ifdef DIAG     
+                        printf("volume is %d\n", n);
+#endif
+                        if((n >= 0) && (n <= 100))
+ saved_volume = n;
+                    }
+
                     else if (1 == sscanf(confline, "show24hr = %d\n", &n)) {
 #ifdef DIAG     
                         printf("show24hr is %d\n", n);
@@ -1684,6 +1709,9 @@
                 fprintf(cfgf, "# OSS/ALSA sound control name to use, autosel means 'try to pick for me'\n");
                 fprintf(cfgf, "sound_control_name = %s\n", sound_control_name);
                 fprintf(cfgf, "\n");
+                fprintf(cfgf, "# OSS/ALSA sound volume level (0 to 100)\n");
+                fprintf(cfgf, "sound_volume_level = %d\n", sound_p->value());
+                fprintf(cfgf, "\n");
                 fprintf(cfgf, "# Automatically pop up right-click menu when Ctrl key is first pressed (1 = do, 0 = don't)\n");
                 fprintf(cfgf, "menu_hotkey_activation = %d\n", menu_hotkey_activation);
                 fprintf(cfgf, "\n");
@@ -1858,6 +1886,13 @@
         make_window_dock();   
     }
 
+ if(saved_volume >= 0)
+ {
+ MainWnd.set_sound_level(saved_volume);
+#ifdef DIAG
+ printf("saved_volume=%d\n", saved_volume);
+#endif
+ }
     //XSetInputFocus(fl_display, PointerRoot, RevertToPointerRoot, CurrentTime);
     while(Running) {
         Fl::wait(5.0);
Title: Re: TCE 10.0 32bit, flit.tcz, Lenovo b4030
Post by: Juanito on March 08, 2019, 03:58:44 AM
Thanks - flit updated in the repos and tinycore git