Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I am currently running Linux 7.2 and I am having some problems in reading and writing the serial ports with "binary" data. I can properly set up the serial port for reading and writing of ASCII data, but when it comes to binary data then I have the problem.... some of my code looks like the following:
unsigned char XYStatusRequest;
XYStatusRequest = 0xB3; // this is just a request buffer to obtain data
XYStatusRequest = 0x58; // from some hardware that I interface to
XYStatusRequest = 0x59;
XYStatusRequest = 0x0D;
Then, I write the data out of serial port #3 with the assistance of a "timer" as follows....
c = write(fd_serial_port_3, (void *) &XYStatusRequest, sizeof(long));
This code appears to be working for the writing of the binary data out of the serial port to the hardware device or to Procomm. If you see a problem in how I have coded it, please let me know as well. Thank you very much!
Then, the readback function expects 12 bytes of binary data from serial port #3. This code to read back the data from serial port #3 with the assistance of a "timer" looks like the following....
unsigned char XYStatusRequestReadback;
c = read(fd_serial_port_3, (void *) &XYStatusRequestReadback,
THIS code FAILS to retrieve the binary data and only will retrieve ASCII data, and to boot it needs a <CR> or 0x0D on the end of the data to even read the bytes that I send to it!
I have tried to sending the data to the port via Procomm, but with no luck so far!
Any assistance that you can afford to me would be greatly appreciated! Thank you very much for all of your time and consideration!
Try the serial programming how-to at www.tldp.org. Unix/Linux serial ports are typically set up for use by terminals and would need to be set to 'raw' or 'non-canonical' mode for binary (non-ASCII) data.
Thank you very much Doug as my problem is now solved!!!!! I did like you said and programmed my Linux serial port for their typical set up for use by terminals and their need to be set to 'raw' or 'non-canonical' mode for binary (non-ASCII) data. After changing my serial port configuration everything worked!