LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   write() error (https://www.linuxquestions.org/questions/linux-hardware-18/write-error-580150/)

d2e2004 08-27-2007 08:30 AM

write() error
 
hi everybody,

while writing data to the serial port it writes random no of bytes every time we write using the write ()

what will be the problem in this

wjevans_7d1@yahoo.co 08-28-2007 05:48 PM

I refrained from answering up to now, because I wanted this question to remain on the "Zero Replies" list until perhaps some expert saw it.

But the question is over 24 hours old, so I'll give it a shot.

I have three questions.
  1. Have you handled the parity bit/stop bit/data bits per byte/Baud rate issues correctly?
  2. When you say that it writes a random number of bytes per write(), are you measuring this by what you see on the serial device itself, or the return value from the write() call, or both?
  3. Are you doing synchronous input/output, or asynchronous input/output? Which one?

d2e2004 08-29-2007 04:08 AM

thanks for ur reply.
actually i solved the problem by omitting the non blocking mode parameter while opening the serial port(O_NDELAY).

but now i got problem in read()
ie.,it does not reads the whole data which is written to the serial port
once again thanks...

Quote:

Originally Posted by wjevans_7d1@yahoo.co (Post 2873917)
I refrained from answering up to now, because I wanted this question to remain on the "Zero Replies" list until perhaps some expert saw it.

But the question is over 24 hours old, so I'll give it a shot.

I have three questions.
  1. Have you handled the parity bit/stop bit/data bits per byte/Baud rate issues correctly?
  2. When you say that it writes a random number of bytes per write(), are you measuring this by what you see on the serial device itself, or the return value from the write() call, or both?
  3. Are you doing synchronous input/output, or asynchronous input/output? Which one?


wjevans_7d1@yahoo.co 09-01-2007 10:45 AM

You may not get all the data on the first read(). You may have to do more read()s to get the rest of the data.

d2e2004 09-03-2007 07:47 AM

actually it is reading the whole characters but the characters at the position which are the multiples of 64 is not readed correctly.ie., at the position 64,128,192,256 etc...
actually i am connecting a fullspeed USB device.

wjevans_7d1@yahoo.co 09-04-2007 05:18 PM

I'm afraid I can't help you here. I'm hoping someone else will enter the conversation.

But to move the conversation along a little, what happens to the 64th character? Is it completely missing, so that you get 63 characters out of every 64? Or is it changed to something else? Or what?

d2e2004 09-05-2007 12:14 AM

the read operation is not behaving as expected .ie if we write 64 characters means it reads zero chracters but if we write characters between 65-127 means it reads whole characters which are written. again the same problem in 128(i,e multiples of 64).
please help me as soos as possible because i need the solution urgently

wjevans_7d1@yahoo.co 09-06-2007 12:58 AM

I'm not really sure I can help at all. Since no one else has jumped into this conversation, if you need the solution urgently, you may wish to turn to other resources for help.

I'm particularly confused because my understanding of the symptoms as you relate them in post #5 is completely different from those you relate in post #7.


All times are GMT -5. The time now is 01:30 AM.