LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 07-08-2014, 05:10 AM   #1
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,055

Rep: Reputation: Disabled
How-to compute the font size to get a given terminal size with fbterm?


I have installed fbterm and need to use in a shell script the output of the command "fbterm -v", which gives information about display settings.

Unfortunately, redirection of the output to a file like one of these commands:
Code:
fbterm -v > output.txt
fbterm -v 2>&1 | tee output.txt
doesn't work (output.txt is empty), probably linked to the fact that running fbterm (mandatorily from an interactive tty) opens a /dev/pts/something as you can see here
Code:
 4477 tty2     Ss     0:00 -bash
 5262 tty2     S+     0:00  \_ fbterm -v
 5263 pts/5    Ss+    0:00      \_ /bin/bash
I also tried to run script before issuing the command, but then the output of "fbterm -v" is just
Code:
stdin isn't a interactive tty!
for a similar reason:
Code:
 5331 tty2     Ss     0:00 -bash
 5345 tty2     S+     0:00  \_ script
 5346 tty2     S+     0:00      \_ script
 5347 pts/5    Ss+    0:00          \_ bash -i
I also thought about taking a "picture" of the screen after running "fbterm -v" but do not know an utility to do that (the ones I know work only under X).

Any help appreciated.

PS The initial title of this thread was :
How-to store the output of "fbterm -v"?
I have modified it to highlight the aim, as previous title was actually a way to reach it, and eventually another way will be used.

Last edited by Didier Spaier; 07-11-2014 at 03:37 PM.
 
Old 07-08-2014, 05:46 AM   #2
Loomx
Member
 
Registered: Sep 2012
Distribution: Slackware
Posts: 184

Rep: Reputation: Disabled
Maybe you could start screen or tmux first, then use their built-in copy mode to copy the info you need, then paste it into a text editor.

For the screenshot idea, I have used fbgrab in the past, but all the links to it seem dead now.
There is also fbshot http://www.sfires.net/fbshot/ which looks like it is from 2002...
 
1 members found this post helpful.
Old 07-08-2014, 06:44 AM   #3
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,055

Original Poster
Rep: Reputation: Disabled
@Loomx: thanks for the clue. Unfortunately, I can't use screen, because typing "Ctr+a h" would need an user input and all have to be done by a non interactive script.

Also, running fbterm inside screen also fails (running fbterm inside screen would be kind of running a terminal inside a terminal :-)

fbshot can take screenshots from a Linux frame buffer, but I need to get the output even when no frame buffer is used (i.e. with the "nomodeset" kernel parameter in the command line). Considering the name, I assume that the same applies to fbgrab.

Last edited by Didier Spaier; 07-08-2014 at 06:51 AM.
 
Old 07-08-2014, 08:32 AM   #4
brianL
LQ 5k Club
 
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Slackware64 15; SlackwareARM-current (aarch64); Debian 12
Posts: 8,298
Blog Entries: 61

Rep: Reputation: Disabled
Have you tried this?
Quote:
copy/paste selected text between windows with mouse when gpm server is running
From:
https://code.google.com/p/fbterm/
Never used fbterm, so might be a dumb question.

Last edited by brianL; 07-08-2014 at 08:34 AM.
 
Old 07-08-2014, 08:38 AM   #5
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,055

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by brianL View Post
Have you tried this?case have been found where

Fromorted
https://code.google.com/p/fbterm/
Never used fbterm, so might be a dumb question.
Not a dumb question, but this requires an interaction with the user (using a mouse), that is not acceptable in this case.

PS To clarify: this has to occur using Slint installer just before user is suggested to choose another keymap if need be (as in Slackware genuine installer). In the installers in http://slint.fr/testing we use fbterm but a test case has been found (using some specific hardware) where the "guess" of the display resolution set by fbterm fails, leading to a too big font size. To avoid that situation we need to know the resolution it actually sets, as reported by fbterm -v, then kill fbterm and re-launch it with the good font size set by the script (however that seems a bit convoluted, I admit. I'm open to simpler solutions that could be suggested :-)

Last edited by Didier Spaier; 07-08-2014 at 09:25 AM. Reason: a test case s/have/has/ been found
 
Old 07-08-2014, 09:21 AM   #6
brianL
LQ 5k Club
 
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Slackware64 15; SlackwareARM-current (aarch64); Debian 12
Posts: 8,298
Blog Entries: 61

Rep: Reputation: Disabled
Ah, I see. Thanks for the clarification. No idea how to solve it, though.

Slightly on-and-off-topic.
I can't use the VESA framebuffer because I'm using the NVidia driver, and I seem to remember they interfere with each other. Or at least, that used to happen.

Last edited by brianL; 07-08-2014 at 09:27 AM.
 
Old 07-08-2014, 12:01 PM   #7
ml4711
Member
 
Registered: Aug 2012
Location: Ryomgård, Danmark
Distribution: Slackware64
Posts: 146

Rep: Reputation: 103Reputation: 103
Maybe You can use resize:

Code:
resize
TERMCAP='lx|...
...
...:r3=\Ec:';
export TERMCAP;
COLUMNS=240;
LINES=75;
export COLUMNS LINES;
There You have width and hight
 
Old 07-08-2014, 12:31 PM   #8
Arkerless
Member
 
Registered: Mar 2006
Distribution: Give me Slack or give me death.
Posts: 81

Rep: Reputation: 60
I dont use fbterm either. I did a little searching but I fear I found nothing of real value.

I do have a suggestion, however. If I am understanding correctly, fbterm is actually programmed to make sure its output is not being redirected, which is somewhat appropriate when invoked normally, but wildly inappropriate when used with the switch in question. So I would suggest you use the source. Find the check, and neuter it. You could disable it entirely, probably the quickest and easiest solution, or for a cleaner solution just bypass the check when this particular switch is used.
 
Old 07-08-2014, 12:42 PM   #9
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,055

Original Poster
Rep: Reputation: Disabled
@ml4711: thanks, but unfortunately we're not in an xterm during Slackware's installation.
@Arkerless: thanks for the suggestion, I'll try that and see what I come up with.
 
Old 07-08-2014, 12:51 PM   #10
ml4711
Member
 
Registered: Aug 2012
Location: Ryomgård, Danmark
Distribution: Slackware64
Posts: 146

Rep: Reputation: 103Reputation: 103
Actually resize also works in a console and in fbterm!
 
Old 07-08-2014, 01:25 PM   #11
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,055

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by ml4711 View Post
Actually resize also works in a console and in fbterm!
Yes, but to display then terminal size only, of course. But I need to know the current resolution to compute the "good" font size (i.e. the biggest font size that will allow to display, say, at least 30 lines and 85 columns).

Maybe someone could add to fbterm an option to set the terminal size and compute the font size accordingly, like this:
Code:
fbterm --terminal-size <COLUMNS>x<LINES>
Of course that should work with and without a frame buffer...

Any volunteer?

I could try... If only I was able to code in C++ and knew VESA, VBE, EDID and the like...

Last edited by Didier Spaier; 07-08-2014 at 01:55 PM.
 
Old 07-08-2014, 01:51 PM   #12
ml4711
Member
 
Registered: Aug 2012
Location: Ryomgård, Danmark
Distribution: Slackware64
Posts: 146

Rep: Reputation: 103Reputation: 103
Quote:
Yes, but to display then terminal size only, of course. But I need to know the current resolution to compute the "good" font size (i.e. the biggest font size that will allows to display, say, at least 30 lines and 85 columns).
OK, I see.

Then use fbset to get the size in pixels, before You call fbterm

Code:
fbset

mode "1680x1050"
    geometry 1680 1050 1680 1050 32
...
 
1 members found this post helpful.
Old 07-08-2014, 05:22 PM   #13
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,055

Original Poster
Rep: Reputation: Disabled
Promising, but... fbset fails if there is no frame buffer device.

So, I am wondering: can I force usage of a frame buffer during installation?

One of the most generic drivers is vesafb, but it works only for devices compliant to at least VESA 2.0 (not VESA 1.2), so no luck for very old cards.

There is also vga16fb (but can we use only 16 colors?).

I tried a command line with "video=vga16fb nomodeset" appended, I'm not sure that the syntax be correct (I should better read modedb.txt in the kernel's documentation) but anyway I end up with a VESA VGA frame buffer device, maybe because vesafb is built in in the huge kernel's configuration (I have to check the generic's and the installer's configurations). I still can modprobe vga16fb and then end up with two frame buffer devices, but I could set the environment variable FRAMEBUFFER to tell fbterm which one it should use. Anyhow blacklisting all other frame buffer modules to prevent handovers would be an extreme measure, I think. I just hope that modprobing vga16fb when any other frame buffer module is loaded has no bad consequence...

It's late here, so I'll investigate further tomorrow (actually, later today :-).

Last edited by Didier Spaier; 07-08-2014 at 06:08 PM.
 
Old 07-08-2014, 07:46 PM   #14
genss
Member
 
Registered: Nov 2013
Posts: 741

Rep: Reputation: Disabled
just a thought

echo `fbterm -v` | tee yes_please.txt

doubt it will work thou
 
Old 07-08-2014, 07:54 PM   #15
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,055

Original Poster
Rep: Reputation: Disabled
Alas, that doesn't work. Thanks anyway.

Last edited by Didier Spaier; 07-08-2014 at 07:57 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
square brackets in output of "ps aux" not matching output of "ps -ejH" alirezan1 Linux - Newbie 14 07-14-2010 04:17 AM
printing hh in hh:mm using "awk '{FS=":";print $1}'" misses first line of output!! mayankmehta83 Linux - Newbie 2 12-03-2009 02:55 AM
"failed to execute child process" "Input/output error" fl.bratu Fedora 4 12-15-2008 04:03 AM
Feeding the output of "diff" or "cat" command to dpkg --purge kushalkoolwal Debian 9 06-19-2008 07:27 AM
New SQUID user: How to clear the "access.log" and "store.log" automatically? yuzuohong Linux - Networking 2 12-02-2006 05:37 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 09:17 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration