Need Help with Perl5.6.1 & ioctl on HPUX 11.00 system

Need Help with Perl5.6.1 & ioctl on HPUX 11.00 system

Post by kcur.. » Fri, 26 Oct 2001 01:12:18



I have recently downloaded & compiled Perl5.6.1.
I am trying to use ioctl to access and setup a tty for modem use.
I keep getting an invalid argument returned by ioctl.

    Perl 5.6.1 compiled cleanly, I ran "h2ph -r -l *" as root from
/usr/include.

Any help would be appreciated.
Thanks in advance
-Keith

Here is a sample of the test code:
==========================================================================
#!/usr/local/bin/perl

use POSIX;
use IO::Handle;

require 'sys/modem.ph';
require 'termios.ph';
require 'sys/termios.ph';
require 'sys/termiox.ph';
require 'sys/ttold.ph';
require 'sys/strtio.ph';

my $junk;

my $rc = 0;

my $fd = POSIX::open("/dev/tty2a7",&POSIX::O_RDWR | &POSIX::O_NOCTTY |
&POSIX::O_NONBLOCK ) ;

my $handle = new_from_fd IO::Handle ($fd, "r");
$tcgetx = defined(&TCGETX) ? &TCGETX :0;
print "\n\nTCGETX=>>$tcgetx<<\n\n";

$rc = ioctl($handle,$tcgetx, $junk);

print "\nIOCTL RC=>>$rc<<\nSYSTEM returned >>$!<<\n\n\n";

POSIX::close($fd);
==========================================================================

 
 
 

Need Help with Perl5.6.1 & ioctl on HPUX 11.00 system

Post by Ulrich Wind » Fri, 26 Oct 2001 18:23:54



> I have recently downloaded & compiled Perl5.6.1.

BTW: I realized that Perl 5.6.1 is on the September Applicarion CDs!
Never before HP was so much up to date!

Quote:> I am trying to use ioctl to access and setup a tty for modem use.
> I keep getting an invalid argument returned by ioctl.

>     Perl 5.6.1 compiled cleanly, I ran "h2ph -r -l *" as root from
> /usr/include.

> Any help would be appreciated.

Append "-w" to the first line, and add "use strict;" in the second.
This helps in many cases.
Quote:> Thanks in advance
> -Keith

> Here is a sample of the test code:
> ==========================================================================
> #!/usr/local/bin/perl

> use POSIX;
> use IO::Handle;

> require 'sys/modem.ph';
> require 'termios.ph';
> require 'sys/termios.ph';
> require 'sys/termiox.ph';
> require 'sys/ttold.ph';
> require 'sys/strtio.ph';

> my $junk;

> my $rc = 0;

> my $fd = POSIX::open("/dev/tty2a7",&POSIX::O_RDWR | &POSIX::O_NOCTTY |
> &POSIX::O_NONBLOCK ) ;

> my $handle = new_from_fd IO::Handle ($fd, "r");
> $tcgetx = defined(&TCGETX) ? &TCGETX :0;
> print "\n\nTCGETX=>>$tcgetx<<\n\n";

> $rc = ioctl($handle,$tcgetx, $junk);

> print "\nIOCTL RC=>>$rc<<\nSYSTEM returned >>$!<<\n\n\n";

> POSIX::close($fd);
> ==========================================================================


 
 
 

Need Help with Perl5.6.1 & ioctl on HPUX 11.00 system

Post by kcur.. » Sat, 27 Oct 2001 00:54:37


I installed perl5.6.1 from the September  CD.
I tried running the test script. And I  get "invalid argument" when I
try the ioctl command.

I have also tried the samlpe code that I found with the perldocs on
ioctl.  Same result as
above.

Any  Suggestions?
Thanks again,
--Keith



>>I have recently downloaded & compiled Perl5.6.1.

>BTW: I realized that Perl 5.6.1 is on the September Applicarion CDs!
>Never before HP was so much up to date!

>>I am trying to use ioctl to access and setup a tty for modem use.
>>I keep getting an invalid argument returned by ioctl.

>>    Perl 5.6.1 compiled cleanly, I ran "h2ph -r -l *" as root from
>>/usr/include.

>>Any help would be appreciated.

>Append "-w" to the first line, and add "use strict;" in the second.
>This helps in many cases.

>>Thanks in advance
>>-Keith

>>Here is a sample of the test code:
>>==========================================================================
>>#!/usr/local/bin/perl

>>use POSIX;
>>use IO::Handle;

>>require 'sys/modem.ph';
>>require 'termios.ph';
>>require 'sys/termios.ph';
>>require 'sys/termiox.ph';
>>require 'sys/ttold.ph';
>>require 'sys/strtio.ph';

>>my $junk;

>>my $rc = 0;

>>my $fd = POSIX::open("/dev/tty2a7",&POSIX::O_RDWR | &POSIX::O_NOCTTY |
>>&POSIX::O_NONBLOCK ) ;

>>my $handle = new_from_fd IO::Handle ($fd, "r");
>>$tcgetx = defined(&TCGETX) ? &TCGETX :0;
>>print "\n\nTCGETX=>>$tcgetx<<\n\n";

>>$rc = ioctl($handle,$tcgetx, $junk);

>>print "\nIOCTL RC=>>$rc<<\nSYSTEM returned >>$!<<\n\n\n";

>>POSIX::close($fd);
>>==========================================================================

 
 
 

Need Help with Perl5.6.1 & ioctl on HPUX 11.00 system

Post by Ulrich Wind » Tue, 30 Oct 2001 20:20:43


What are ypou trying to do?

I had success with $tios->getattr(), setiflag(), setispeed(),
setospeed(), setattr, etc. ($tios = new POSIX::Termios;)

Ulrich


> I installed perl5.6.1 from the September  CD.
> I tried running the test script. And I  get "invalid argument" when I
> try the ioctl command.

> I have also tried the samlpe code that I found with the perldocs on
> ioctl.  Same result as
> above.

> Any  Suggestions?
> Thanks again,
> --Keith



> >>I have recently downloaded & compiled Perl5.6.1.

> >BTW: I realized that Perl 5.6.1 is on the September Applicarion CDs!
> >Never before HP was so much up to date!

> >>I am trying to use ioctl to access and setup a tty for modem use.
> >>I keep getting an invalid argument returned by ioctl.

> >>    Perl 5.6.1 compiled cleanly, I ran "h2ph -r -l *" as root from
> >>/usr/include.

> >>Any help would be appreciated.

> >Append "-w" to the first line, and add "use strict;" in the second.
> >This helps in many cases.

> >>Thanks in advance
> >>-Keith

> >>Here is a sample of the test code:
> >>==========================================================================
> >>#!/usr/local/bin/perl

> >>use POSIX;
> >>use IO::Handle;

> >>require 'sys/modem.ph';
> >>require 'termios.ph';
> >>require 'sys/termios.ph';
> >>require 'sys/termiox.ph';
> >>require 'sys/ttold.ph';
> >>require 'sys/strtio.ph';

> >>my $junk;

> >>my $rc = 0;

> >>my $fd = POSIX::open("/dev/tty2a7",&POSIX::O_RDWR | &POSIX::O_NOCTTY |
> >>&POSIX::O_NONBLOCK ) ;

> >>my $handle = new_from_fd IO::Handle ($fd, "r");
> >>$tcgetx = defined(&TCGETX) ? &TCGETX :0;
> >>print "\n\nTCGETX=>>$tcgetx<<\n\n";

> >>$rc = ioctl($handle,$tcgetx, $junk);

> >>print "\nIOCTL RC=>>$rc<<\nSYSTEM returned >>$!<<\n\n\n";

> >>POSIX::close($fd);
> >>==========================================================================