DaemonForums  

Go Back   DaemonForums > NetBSD > NetBSD General

NetBSD General Other questions regarding NetBSD which do not fit in any of the categories below.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 29th August 2014
spermwhale_warrior spermwhale_warrior is offline
Port Guard
 
Join Date: May 2013
Posts: 44
Thanked 0 Times in 0 Posts
Question question about X inner working(and netbsd's)

Someone said that X do not open a tty.
Then how is it called, the place that one can access through CtrL+ALT+F[6-9] and which show graphical things ?
How can we say to run but to not occupy the screen, to do everything like it would run Xserver without actually messing with the screen, or if you want, without sending binary data(which I caught with 'script') that used to be pictures when it works ? I am not programmer(not yet) but I would like to know more about the systems's inner working.
The question was to begin with, why 'X > /dev/null 2>&1' doesn't nullify the graphical ouput, as I thought it was just in the end an virtual terminal made busy with pictures.

Thanks
Reply With Quote
  #2   (View Single Post)  
Old 29th August 2014
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 3,710
Thanked 214 Times in 189 Posts
Default

X11 communicates with your display, mouse, keyboard, and other human interface devices via software called the "X Server". This may be software on a general purpose computer, such as you are using with NetBSD, or, this may be embedded in the equipment. An embedded X Server is often called an X Terminal.

This may help.

Reply With Quote
  #3   (View Single Post)  
Old 29th August 2014
spermwhale_warrior spermwhale_warrior is offline
Port Guard
 
Join Date: May 2013
Posts: 44
Thanked 0 Times in 0 Posts
Default

But, talking about your schema, what are you accessing to when you switch from a tty to graphical display ? An x terminal ?
Reply With Quote
  #4   (View Single Post)  
Old 29th August 2014
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 3,710
Thanked 214 Times in 189 Posts
Default

I don't run an embedded X display, and have no X Terminals. My X Servers that I run on OpenBSD consist of 365 files. These are comprised of:
  • 9 executable programs stored in /usr/X11R6/bin
  • 154 dynamic library files stored in /usr/X11R6/lib
  • 143 header files stored in /usr/X11R6/include
  • 54 man pages stored in /usr/X11R6/man
  • 5 miscellaneous files.
The executable files include the program /usr/X11R6/bin/X, but not scripts such as /usr/X11R6/bin/startx which call X. In OpenBSD, even though these are used with the X Server, they are packaged in a fileset with other text files. NetBSD might define these scripts as components of the X Server.

The libraries predominantly consist of hardware drivers for video cards, mice, displays, and keyboards. For example, there are six libraries that have the name "radeon" among the library files included with OpenBSD's X Server.

Both NetBSD and OpenBSD use the X.Org implementation of the X Windows System, but there are packaging and operational differences.

Last edited by jggimi; 29th August 2014 at 09:56 PM. Reason: typo
Reply With Quote
  #5   (View Single Post)  
Old 30th August 2014
IdOp's Avatar
IdOp IdOp is offline
Too dumb for a smartphone
 
Join Date: May 2008
Location: twisting on the daemon's fork(2)
Posts: 564
Thanked 14 Times in 13 Posts
Default

Quote:
Originally Posted by spermwhale_warrior View Post
Someone said that X do not open a tty.
Then how is it called, the place that one can access through CtrL+ALT+F[6-9] and which show graphical things ?
I think the term "tty" derives from its use as a short-hand for teletypewriter. In Net/Open-BSD we have "wsconsoles", similar to the Linux "virtual consoles". We switch between them with Ctrl-Alt-FN (or no Ctrl- in Linux). Many of these are set up as text consoles. But they don't have to be, X can grab one and set it up for graphical display. When it does that it isn't using the same character-based protocols as it would on a text tty. I hope the above is more-or-less correct, I don't have a deep knowledge of the inner workings.
Reply With Quote
  #6   (View Single Post)  
Old 30th August 2014
spermwhale_warrior spermwhale_warrior is offline
Port Guard
 
Join Date: May 2013
Posts: 44
Thanked 0 Times in 0 Posts
Default

thanks, that was very clear.
And, are wsconsole attached to file descriptor,
like exec 4 < /dev/something ? I want to be able to say : from this wsconsole, open that program, but send the errors in that one, and normal output in that one.

Last edited by spermwhale_warrior; 30th August 2014 at 05:16 PM.
Reply With Quote
  #7   (View Single Post)  
Old 30th August 2014
IdOp's Avatar
IdOp IdOp is offline
Too dumb for a smartphone
 
Join Date: May 2008
Location: twisting on the daemon's fork(2)
Posts: 564
Thanked 14 Times in 13 Posts
Default

Quote:
Originally Posted by spermwhale_warrior View Post
thanks, that was very clear.
And, are wsconsole attached to file descriptor,
like exec 4 < /dev/something ? I want to be able to say : from this wsconsole, open that program, but send the errors in that one, and normal output in that one.
I may not properly understand the question, but I'm not aware of them being attached to standard file descriptors the way stdin (0), stdout (1) and stderr (2) are. But maybe you don't need that for what you want to do, anyway.

If you're working in a terminal, you can get the name of that terminal using the tty(1) command, e.g.,

$ tty
/dev/ttyE2

Actually this is the device file that corresponds to the terminal you're working in (a text wsconsole).

Now, suppose you want to send the stdout of a program to a different terminal, say ttyE3. Then you can direct it there like this:

$ echo foo > /dev/ttyE3

and you should see "foo" displayed on the other terminal, provided you have write permission on that terminal. You can check this from the permissions shown in

$ ls -l /dev/ttyE3

You may need to be logged in on ttyE3 to have the necessary permissions.

Similarly you could send stderr to another terminal, or take input from another terminal.

Does this help with what you want to do?

I also wanted to mention some man pages:

ttys(5)

wscons.conf(5)

ttyaction(5)

These are files in /etc that are used to configure terminal things. The pages refer to other useful pages too.
Reply With Quote
  #8   (View Single Post)  
Old 30th August 2014
spermwhale_warrior spermwhale_warrior is offline
Port Guard
 
Join Date: May 2013
Posts: 44
Thanked 0 Times in 0 Posts
Lightbulb

Quote:
Originally Posted by IdOp View Post
Does this help with what you want to do?
Absolutely ! That is exquisite. This kind of information is way much difficult to find for a beginner.
Reply With Quote
  #9   (View Single Post)  
Old 31st August 2014
IdOp's Avatar
IdOp IdOp is offline
Too dumb for a smartphone
 
Join Date: May 2008
Location: twisting on the daemon's fork(2)
Posts: 564
Thanked 14 Times in 13 Posts
Default

Quote:
Originally Posted by IdOp View Post
Similarly you could ... take input from another terminal.
I've just been fooling around with this a bit and been unable to demonstrate this part. Not sure if it can't be done, or more likely I haven't figured out the trick.

EDIT:

Partial success. What I was doing, on ttyE1, was:

$ cat >/dev/null </dev/ttyE2

then type in ttyE2. Nothing showed on ttyE1, but maybe it was being sent to /dev/null without echoing. So I changed it to:

$ cat >myfile </dev/ttyE2

This would put something into myfile, without echoing it. But not the first stuff coming from ttyE2. It would seem to "get stuck" and text typed then would go into myfile. Needed Ctrl-C to break out. Weird. Anyway, this part probably isn't what you wanted to do.

Last edited by IdOp; 31st August 2014 at 01:22 AM.
Reply With Quote
Old 31st August 2014
spermwhale_warrior spermwhale_warrior is offline
Port Guard
 
Join Date: May 2013
Posts: 44
Thanked 0 Times in 0 Posts
Default

THAT is what I want. It is surprising that we found an impredictable behavior.
It should work, or at least we should know that it can't.
(cat < /dev/ttyE2) | tee myfile do not echo anything in myfile, and on ttyE2 was a ongoing string of yes.
insteat, it occupy the current tty, like it was waiting data. But nothing got on the file.
I thought I understood the logic of echo, cat, tee and the redirections, but it seems there are some mysteries yet.
Reply With Quote
Old 31st August 2014
bsd-keith bsd-keith is offline
Real Name: Keith
Linux from 1999 & now BSD
 
Join Date: Jun 2014
Location: Surrey/Hants Border, England
Posts: 17
Thanked 0 Times in 0 Posts
Default

I am thinking that you are slightly misunderstanding redirection.
Only a 'file' can be redirected.
'X' 'pages' are created in video ram and then sent to the screen, (/dev/tty).
__________________
Linux since 1999, now a BSD user.
Reply With Quote
Old 31st August 2014
spermwhale_warrior spermwhale_warrior is offline
Port Guard
 
Join Date: May 2013
Posts: 44
Thanked 0 Times in 0 Posts
Default

And no special files are created to grant raw bitmap access to them ? Ok.
Yet, I don't why it is able to call forth an ongoing column of yes from a tty, to another. It could duplicate the text output.
Reply With Quote
Old 31st August 2014
IdOp's Avatar
IdOp IdOp is offline
Too dumb for a smartphone
 
Join Date: May 2008
Location: twisting on the daemon's fork(2)
Posts: 564
Thanked 14 Times in 13 Posts
Default

Quote:
Originally Posted by spermwhale_warrior View Post
THAT is what I want. It is surprising that we found an impredictable behavior.
It should work, or at least we should know that it can't.
I feel sure the problem is with the predictors (that is, us ). It probably works correctly, but we don't understand all the "inner workings" of how it may be affected by terminal configuration (e.g., input buffering) and how/when it takes over input from the program (a shell) already running in the second terminal.

Granted, there is a theoretical question here of how it works, that could be studied for a long time. But I'm not really sure why you would want to do this. Maybe I haven't read the other posts carefully enough and it is explained there.

Quote:
(cat < /dev/ttyE2) | tee myfile do not echo anything in myfile, and on ttyE2 was a ongoing string of yes.
insteat, it occupy the current tty, like it was waiting data. But nothing got on the file.
I thought I understood the logic of echo, cat, tee and the redirections, but it seems there are some mysteries yet.
Did you try my second example? Once the text stopped echoing in the second terminal (where it was being typed) --- I called this "getting stuck" above --- then that stuff went into the file. I'm not sure why your example behaved differently, and I'm in X now so ... must try later.
Reply With Quote
Old 31st August 2014
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 3,710
Thanked 214 Times in 189 Posts
Default

I think we should take a step back, and level set based on a question in the first post in the thread, as there may be some confusion.
Quote:
Originally Posted by spermwhale_warrior View Post
The question was to begin with, why 'X > /dev/null 2>&1' doesn't nullify the graphical ouput, as I thought it was just in the end an virtual terminal made busy with pictures.
The X Window System is a ... well ... it is a system for graphical manipulation and display. It does not use standard files -- or named files -- for data movement between application and display. Instead, it uses network sockets, as shown in the graphic I included earlier in this thread, for communication between X Client (the graphical application) and X Server (human interfaces). The X Server communicates via hardware drivers with hardware: keybaords, mice, displays, and other devices.

X Clients may or may not use standard files. They are optional.

To add some confusion, among X Client applications are terminal (tty) emulators such as xterm. These are used to run interactive shells, which may include manipulating applications that use standard files -- whether these applications happen to be other X Clients or not.

Last edited by jggimi; 31st August 2014 at 05:33 PM. Reason: typos
Reply With Quote
Reply

Thread Tools
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
WPA Not working on some routers? xmorg FreeBSD General 3 30th April 2011 04:36 PM
Mouse:X (not-working) and tty-Console (working), in 8.0 ykt FreeBSD General 1 22nd December 2009 12:26 PM
Working with CVS? Zmyrgel OpenBSD General 15 6th October 2009 01:32 PM
external drive partition question + fdisk question gosha OpenBSD General 15 15th June 2009 02:00 PM
hardware not working Terminal-Chaos FreeBSD General 2 29th May 2008 05:32 AM


All times are GMT. The time now is 11:26 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick