- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- How to output a character to serial port (/dev/tty...
Operating System - HP-UX
1823415
Members
2615
Online
109655
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-04-2006 12:55 PM
тАО01-04-2006 12:55 PM
How to output a character to serial port (/dev/tty0p0)
I have a scanner , and I made the scanner's auto trigger is a character "T".
I use my PC(windos xp)'s serial port to output a character "T" or in hex mode"54" to the scanner, The scanner then auto start to read.
By now, I want to use this scanner on Unix controller(B2000)10.* Hp-unix.
I tried several ways to output "T" to the scanner, But I am failed.
Could you give me some suggestions on how to output a character to the serial port and the read back something from the serial port(scanner)?
Thank you very much
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-04-2006 01:00 PM
тАО01-04-2006 01:00 PM
Re: How to output a character to serial port (/dev/tty0p0)
You can write a c code to write/read from serial port. But before that, when you connected scanner to system, is it in claimed state on unix??
Just echoing a char to device should be very easy. You can do as follows.
echo "T" > /dev/device_file_of_device
Reading from it would require some code and in case of scanner, it would be more difficult. Does manufacturer provide some software for unix for thic functionality??
Just echoing a char to device should be very easy. You can do as follows.
echo "T" > /dev/device_file_of_device
Reading from it would require some code and in case of scanner, it would be more difficult. Does manufacturer provide some software for unix for thic functionality??
There is no substitute to HARDWORK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-04-2006 01:54 PM
тАО01-04-2006 01:54 PM
Re: How to output a character to serial port (/dev/tty0p0)
Thank for your quick reply.
but It seems it doesn't work also.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-04-2006 02:17 PM
тАО01-04-2006 02:17 PM
Re: How to output a character to serial port (/dev/tty0p0)
Do you have the right cable? With the B2000, you should have the same connector as the PC (9pin) and it should work. However, your T is being sent at 300 baud. All HP-UX systems set the serial port(s) to 300 baud so you'll have to change the baud rate to the desired rate. The stty command will help but even though you set the port speed, it must remain open for the baud rate to stay at a new setting.
The usual technique is to start a sleep program that runs for several hours and redirect stdin for sleep to use the serial device file. Put the sleep in the background and run the stty program to set the baud rate. Now send the T to the scanner.
Some more details: if you use: echo "T" to send the character, you will get 3 characters by default: T CR LF which may confuse the scanner. Use echo "T\c" to suppress the end of line characters.
Bill Hassell, sysadmin
The usual technique is to start a sleep program that runs for several hours and redirect stdin for sleep to use the serial device file. Put the sleep in the background and run the stty program to set the baud rate. Now send the T to the scanner.
Some more details: if you use: echo "T" to send the character, you will get 3 characters by default: T CR LF which may confuse the scanner. Use echo "T\c" to suppress the end of line characters.
Bill Hassell, sysadmin
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Learn About
News and Events
Support
© Copyright 2025 Hewlett Packard Enterprise Development LP