Sponsored Content
Full Discussion: Managing and using PTSes
Top Forums Programming Managing and using PTSes Post 302711035 by erupter on Friday 5th of October 2012 10:16:43 AM
Old 10-05-2012
Question Managing and using PTSes

Hello.

I need to simulate a few serial links (doing a simulation of an application for a robot) and found socat which, at least with minicom, is working flawlessly.

I would really like to make pts static: ie same numbers between reboots, and automatic (not me opening terminals and leaving them with empty socat windows).
Is there a way for this?

Or maybe there is a (super easy!) way of replicating what socat does inside my own program so that I don't have to start multiple executables?

I also have problems with the ports themselves, don't know if these problems stem from the fact they are virtual.

Here is the bulk of the serial code (bluntly copied from link)
Code:
    fd = open(PortIn, O_RDWR | O_NOCTTY | O_NDELAY);
    if (fd == -1 )
    {
        dbg_print(MAIN_PROC_NAME,"Failed to open input port %s\n",PortIn);
        dbg_print(MAIN_PROC_NAME,"Error: %s\n",strerror(errno));
    }
    else
        dbg_print(MAIN_PROC_NAME,"Connected to port \"%s\"\n",PortIn);

    tcgetattr(fd,&oldtio); /* save current port settings */
    bzero(&newtio, sizeof(newtio));
    newtio.c_cflag = BAUDRATE | CRTSCTS | CS8 | CLOCAL | CREAD;
    newtio.c_iflag = IGNPAR;
    newtio.c_oflag = 0;

    /* set input mode (non-canonical, no echo,...) */
    newtio.c_lflag = 0;

    newtio.c_cc[VTIME]    = 0;   /* inter-character timer unused */
    newtio.c_cc[VMIN]     = 5;   /* blocking read until 5 chars received */

    tcflush(fd, TCIFLUSH);
    tcsetattr(fd,TCSANOW,&newtio);
    while (1) {
        res = read(fd,input_buffer,255);
        if (res > 0)
        {
            input_buffer[res]=0;
            dbg_print(MAIN_PROC_NAME,"String received %s\n",input_buffer);
        }
        if (res < 0)
            dbg_print(MAIN_PROC_NAME,"Error: %s\n",strerror(errno));

All I get is an endless list of
"Resource temporary unavailable"

Thank you for any input.

Last edited by erupter; 10-05-2012 at 11:49 AM..
 

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

managing users

I need to setup several accounts on a solaris system. (passwd,shadow,group) My question is : How can I create a group which can access a machine, but only in certain directories? (4 Replies)
Discussion started by: SmartJuniorUnix
4 Replies

2. UNIX for Advanced & Expert Users

best solution for managing many nameservers

Hello, i was searching around for good solution for managing many nameservers to add the records on the slave servers and update them and if possible some web-based manegment for non-experianced customers. anyone has an idea where can i find such solution? (1 Reply)
Discussion started by: Bashar
1 Replies

3. UNIX for Advanced & Expert Users

Managing nodes???

Does anyone know something about this? I have no idea what it means and how to do it. but if anyone can give me and explanation and also point me to a website, i'd really appreciate it (5 Replies)
Discussion started by: TRUEST
5 Replies

4. Programming

error in managing linklist

I have used link list in my program to operate on set of values the operations that i am doing : add , delete from link list when i am deleting the intermidiate or last value it is not giving any error but when i am deleting the 1 st value then program hangs can anyone suggest me the reason (3 Replies)
Discussion started by: bhakti_2025
3 Replies

5. Solaris

Managing FileSystems on Solaris

Hello. I have got Solaris 10 8/07 on x86 installed successfully using CDs. While I had inserted 1st CD - I created 2 new filesystems also. But now after entering into Solaris - How do I manipulate sizes or created/delete filesystems by going to terminal? Thank you! (15 Replies)
Discussion started by: panchpan
15 Replies

6. What is on Your Mind?

Managing Geeks

Hi, I recently found this article in computerworld and I think it is very true - at least in my company ... what do you guys think - is the author right? Is it ignorant management that makes us IT people seem to be anti-social and weird? Please share your thoughts Kind regards zxmaus (5 Replies)
Discussion started by: zxmaus
5 Replies

7. Solaris

Problems managing user

I installed Solaris 10 in an old Dell computer given to me. The filesystem is ZFS (Default). The problem is that after logging in as root (first login) I wanted to add a user : n2jkw. I added the user at /export/home/n2jkw BTW, /export/home is where the 150G extra Hard Drive is mounted to.... (20 Replies)
Discussion started by: n2jkw
20 Replies

8. UNIX for Dummies Questions & Answers

expr help - managing strings

Hi guys, I need to use regular expressions in linux and I'm not quite experience in that field, maybe someone could give me some help with it. Basically, I need to take a text like this. A234321=http://www.google..... a normal URL But, I need to take the string starting at... (0 Replies)
Discussion started by: ocramas
0 Replies
PTS_QUIT(1)						       AFS Command Reference						       PTS_QUIT(1)

NAME
pts_quit - Exit from pts interactive mode SYNOPSIS
pts quit [-cell] <cell name> [-noauth] [-localauth] [-force] pts q [-c] <cell name> [-n] [-l] [-f] DESCRIPTION
The pts quit command exits from pts interactive mode. The command can be run from the command line or interactively, but on the command line it does nothing and is therefore of questionable utility. CAUTIONS
Prior to OpenAFS 1.4.5 and OpenAFS 1.5.23, the pts quit command was only available on Unix or Linux and when OpenAFS was compiled with the supergroups option (disabled by default). As of OpenAFS 1.4.5 and 1.5.23, it is always available. OPTIONS
Although they have no effect, pts quit takes the following standard pts options: -cell <cell name> Names the cell in which to run the command. For more details, see pts(1). -force Enables the command to continue executing as far as possible when errors or other problems occur, rather than halting execution at the first error. -help Prints the online help for this command. All other valid options are ignored. -localauth Constructs a server ticket using a key from the local /etc/openafs/server/KeyFile file. Do not combine this flag with the -cell or -noauth options. For more details, see pts(1). -noauth Assigns the unprivileged identity anonymous to the issuer. For more details, see pts(1). OUTPUT
This command produces no output. EXAMPLES
Here is an example of a pts interactive session: % pts interactive pts> quit % SEE ALSO
pts(1), pts_interactive(1) COPYRIGHT
Copyright 2007 Jason Edgecombe <jason@rampaginggeek.com> This documentation is covered by the BSD License as written in the doc/LICENSE file. This man page was written by Jason Edgecombe for OpenAFS. OpenAFS 2014-04-08 PTS_QUIT(1)
All times are GMT -4. The time now is 04:06 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy