LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 08-27-2007, 08:30 AM   #1
d2e2004
LQ Newbie
 
Registered: Jul 2005
Location: palakkad
Posts: 11

Rep: Reputation: 0
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

Last edited by d2e2004; 08-27-2007 at 08:31 AM.
 
Old 08-28-2007, 05:48 PM   #2
wjevans_7d1@yahoo.co
Member
 
Registered: Jun 2006
Location: Mariposa
Distribution: Slackware 9.1
Posts: 938

Rep: Reputation: 31
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?
 
Old 08-29-2007, 04:08 AM   #3
d2e2004
LQ Newbie
 
Registered: Jul 2005
Location: palakkad
Posts: 11

Original Poster
Rep: Reputation: 0
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 View Post
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?
 
Old 09-01-2007, 10:45 AM   #4
wjevans_7d1@yahoo.co
Member
 
Registered: Jun 2006
Location: Mariposa
Distribution: Slackware 9.1
Posts: 938

Rep: Reputation: 31
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.
 
Old 09-03-2007, 07:47 AM   #5
d2e2004
LQ Newbie
 
Registered: Jul 2005
Location: palakkad
Posts: 11

Original Poster
Rep: Reputation: 0
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.

Last edited by d2e2004; 09-03-2007 at 07:49 AM.
 
Old 09-04-2007, 05:18 PM   #6
wjevans_7d1@yahoo.co
Member
 
Registered: Jun 2006
Location: Mariposa
Distribution: Slackware 9.1
Posts: 938

Rep: Reputation: 31
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?
 
Old 09-05-2007, 12:14 AM   #7
d2e2004
LQ Newbie
 
Registered: Jul 2005
Location: palakkad
Posts: 11

Original Poster
Rep: Reputation: 0
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

Last edited by d2e2004; 09-05-2007 at 12:25 AM.
 
Old 09-06-2007, 12:58 AM   #8
wjevans_7d1@yahoo.co
Member
 
Registered: Jun 2006
Location: Mariposa
Distribution: Slackware 9.1
Posts: 938

Rep: Reputation: 31
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
aplay: pcm_write:1029: write error: Input/output error mimithebrain Linux - Software 2 12-04-2007 11:51 AM
k3b write error for dvd's (input/output) error mocean SUSE / openSUSE 3 06-27-2007 02:39 PM
K3b CD write error CrownAmbassador Linux - Hardware 3 01-17-2007 01:26 PM
ALSA WRITE ERROR: input/output error Michaelx Slackware 7 07-06-2006 10:56 PM
Write to FAT32 cause error! welson_sun Linux - Software 5 09-07-2004 02:41 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 06:29 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration