Sponsored Content
Top Forums Programming Telling apart serial from // port Post 41004 by Perderabo on Friday 26th of September 2003 01:54:24 PM
Old 09-26-2003
I don't know QNX, and I'm not sure what you mean by serial or // printer. Nor do I understand why you are taking such an odd approach to this.

I think it would make much more sense to be writing a journal_open() and maybe a journal_close(). A journal_write() might also make sense if you need to greatly assist with a device error such as out-of-paper. But there is a lot of one-time setup stuff for many printers.

Also a journal_open() would make the filename visable to you. With unix, you know that /dev/dsk/c0t6d0s4 is not a line printer. Unix has some naming conversions for devices. They vary from version to version...but each version has a well defined convention. I know that the whole raison d'être of fstat() and fcntrl() was to enable programs to work with files already opened by the shell before the program even started to run. But a program like:
diagnose < /dev/any/device
is not a reasonable extention of this. A system can have many line printers. If your particular line printer has trouble, how would phrase the error message without a filename?

If you want to use your approach anyway, I can think of 2 approaches that might work. The first is to get the major number of the device. You do that looking at the st_dev field in the stat structure. You want to use a macro like this:
major(statbuf.st_dev)
where major is a macro in <sys/sysmacros.h>. You would have to know which major number refers to which driver and there is no portable way to do that...well maybe searching /dev. The second approach is to assume it is a serial device. Try a serial ioctl to it. If the ioctl works, it must be serial.

Quote:
how can I get the // printer status the way stty does?
On unix, stty would only work with a serial port. So at this point, I'm confused, however, to configure a serial port on unix using posix conventions, see "man termios". Here is an example. To configure other devices under unix, you would typically use ioctl() with a request that is documented on the man page for the driver that controls the device.
 

10 More Discussions You Might Find Interesting

1. Solaris

serial port signal

hi i am using solaris 9 on sparc . i was wondering if there was a command to control my serial interface , as to send a signal periodically every interval of time to the input of a 555 timer . thanks for your help .... (0 Replies)
Discussion started by: ppass
0 Replies

2. Solaris

Serial Port Datalogger

Hi, I'm using Solaris workstation with 5.4 OS. I was wondering if there's a way that I could log the data incoming and outgoing on a certain serial port. Thanks in Advance! (1 Reply)
Discussion started by: uryuu
1 Replies

3. Linux

urgent......Serial port

I think my serial port(on board) is not working ...... because when I am running same code on two machines its working good....but when my system comes into picture ....it doesnt show any output comming from serial port.......... can anybody tell me how to configure my serial port.........or to... (16 Replies)
Discussion started by: arunchaudhary19
16 Replies

4. Solaris

Serial port not found

Hi, I am working with solaris 9,SUN-Blade-100 and I want to communicate with the Serial port.To check whether the port is working or not.I write code and when I execute the file,then I got the output-- According to this,serial port is not found.can anyone please tell me how to configure the... (1 Reply)
Discussion started by: smartgupta
1 Replies

5. Programming

How to tell if a string to serial port has been sent

I have a need to determine when a string has been completely sent via a serial port from a standard 'C' application. The code is as follows: SerialPort_Send = open (pPortString, O_WRONLY | O_NOCTTY | O_NONBLOCK); write (SerialPort_Send, pCommandString, strlen (pCommandString)); ... (2 Replies)
Discussion started by: ExDes
2 Replies

6. AIX

Serial port in AIX

Hi, How can i configure my modem in AIX thru serial port (sa0-->tty0) I have two port serial card configured as sa0 I created tty1 which port is tty0 and which port is tty1 how can i know?? (1 Reply)
Discussion started by: pchangba
1 Replies

7. Shell Programming and Scripting

Need help with serial port

Hi, I have a external board connected to my serial port. I need to execute "shutdown -r now" command when system boot up. When system boots up it requires a username ans password. Then I need to run my command. I can use rc script but that is rebooting system before it asks for username and... (0 Replies)
Discussion started by: charlie.arya
0 Replies

8. Solaris

How to enable Serial port on ILOM, when Network Port is enabled in parallel

Hi Everyone, In my environment, I have few T5220. On the iLOM Management Card, I have both Network and Serial port are cabled, I don't have any issues while I try to connect using Network Management port, but when I try to connect the serial port for the same server which is actually connected... (3 Replies)
Discussion started by: bobby320
3 Replies

9. Web Development

Setup Serial Port

I need to set a serial port to 9600 7E1. How do I accomplish this? I've tried every combination, with no luck. (6 Replies)
Discussion started by: Meow613
6 Replies

10. Solaris

Cabling and adapters to communicate to service processor serial port from Windows PC with USB port.

Hello, I have an unloaded T5140 machine and want to access the ILOM for the first time and subsequently the network port after that., and then load Solaris 10 the final January 2011 build. The first part is what confuses me -the cabling. I am coming from a Windows machine (w/appropriate... (5 Replies)
Discussion started by: joboy
5 Replies
SYSTEMD-JOURNAL-UPLOAD(8)				      systemd-journal-upload					 SYSTEMD-JOURNAL-UPLOAD(8)

NAME
systemd-journal-upload - Send journal messages over the network SYNOPSIS
systemd-journal-upload [OPTIONS...] [-u/--url=URL] [SOURCES...] DESCRIPTION
systemd-journal-upload will upload journal entries to the URL specified with --url. Unless limited by one of the options specified below, all journal entries accessible to the user the program is running as will be uploaded, and then the program will wait and send new entries as they become available. OPTIONS
-u, --url=[https://]URL, --url=[http://]URL Upload to the specified address. URL may specify either just the hostname or both the protocol and hostname. https is the default. --system, --user Limit uploaded entries to entries from system services and the kernel, or to entries from services of current user. This has the same meaning as --system and --user options for journalctl(1). If neither is specified, all accessible entries are uploaded. -m, --merge Upload entries interleaved from all available journals, including other machines. This has the same meaning as --merge option for journalctl(1). -D, --directory=DIR Takes a directory path as argument. Upload entries from the specified journal directory DIR instead of the default runtime and system journal paths. This has the same meaning as --directory option for journalctl(1). --file=GLOB Takes a file glob as an argument. Upload entries from the specified journal files matching GLOB instead of the default runtime and system journal paths. May be specified multiple times, in which case files will be suitably interleaved. This has the same meaning as --file option for journalctl(1). --cursor= Upload entries from the location in the journal specified by the passed cursor. This has the same meaning as --cursor option for journalctl(1). --after-cursor= Upload entries from the location in the journal after the location specified by the this cursor. This has the same meaning as --after-cursor option for journalctl(1). --save-state[=PATH] Upload entries from the location in the journal after the location specified by the cursor saved in file at PATH (/var/lib/systemd/journal-upload/state by default). After an entry is successfully uploaded, update this file with the cursor of that entry. --follow[=BOOL] If set to yes, then systemd-journal-upload waits for input. --key= Takes a path to a SSL key file in PEM format. Defaults to /etc/ssl/private/journal-upload.pem. --cert= Takes a path to a SSL certificate file in PEM format. Defaults to /etc/ssl/certs/journal-upload.pem. --trust= Takes a path to a SSL CA certificate file in PEM format, or all. If all is set, then certificate checking will be disabled. Defaults to /etc/ssl/ca/trusted.pem. -h, --help Print a short help text and exit. --version Print a short version string and exit. EXIT STATUS
On success, 0 is returned; otherwise, a non-zero failure code is returned. EXAMPLES
Example 1. Setting up certificates for authentication Certificates signed by a trusted authority are used to verify that the server to which messages are uploaded is legitimate, and vice versa, that the client is trusted. A suitable set of certificates can be generated with openssl: openssl req -newkey rsa:2048 -days 3650 -x509 -nodes -out ca.pem -keyout ca.key -subj '/CN=Certificate authority/' cat >ca.conf <<EOF [ ca ] default_ca = this [ this ] new_certs_dir = . certificate = ca.pem database = ./index private_key = ca.key serial = ./serial default_days = 3650 default_md = default policy = policy_anything [ policy_anything ] countryName = optional stateOrProvinceName = optional localityName = optional organizationName = optional organizationalUnitName = optional commonName = supplied emailAddress = optional EOF touch index echo 0001 >serial SERVER=server CLIENT=client openssl req -newkey rsa:1024 -nodes -out $SERVER.csr -keyout $SERVER.key -subj "/CN=$SERVER/" openssl ca -batch -config ca.conf -notext -in $SERVER.csr -out $SERVER.pem openssl req -newkey rsa:1024 -nodes -out $CLIENT.csr -keyout $CLIENT.key -subj "/CN=$CLIENT/" openssl ca -batch -config ca.conf -notext -in $CLIENT.csr -out $CLIENT.pem Generated files ca.pem, server.pem, and server.key should be installed on server, and ca.pem, client.pem, and client.key on the client. The location of those files can be specified using TrustedCertificateFile=, ServerCertificateFile=, ServerKeyFile=, in /etc/systemd/journal-remote.conf and /etc/systemd/journal-upload.conf, respectively. The default locations can be queried by using systemd-journal-remote --help and systemd-journal-upload --help. SEE ALSO
systemd-journal-remote(8), journalctl(1), systemd-journald.service(8), systemd-journal-gatewayd.service(8) systemd 237 SYSTEMD-JOURNAL-UPLOAD(8)
All times are GMT -4. The time now is 05:30 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy