LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 08-15-2006, 05:03 AM   #1
rojak
LQ Newbie
 
Registered: May 2006
Location: Singapore
Distribution: Ubuntu 9.10
Posts: 16

Rep: Reputation: 0
put_user doesn't pass the correct data


Writing a device driver for a ARM9 microcontroller: at last the driver can get the right data from the device. Verified with printk().
However passing the data to user-space with put_user() is giving problems. Basically the read function in the driver calls put_user() as follows:

...
unsigned char buf[BUF_SIZE];
for (i; i<BUF_SIZE; i++)
put_user(buf[i++], buf++);
...

And in user-space just read from file:

...
fp = open("/dev/device", O_RDWR);
read(fp, buf, 1)
...

I don't get the correct data in user-space. Looks more like pointer to uninitialized memory.

Anyone can tell me what I am doing wrong?

TiA!
 
  


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why do we need put_user function? liem_m_k Programming 1 03-27-2006 12:42 PM
How to pass data from one apllication to another. Darkeye Linux - Software 6 10-17-2005 02:10 AM
How to pass data to a console program with multiple inputs? juanbobo Programming 3 08-18-2005 07:39 PM
Pass data between windows agallant Programming 3 10-21-2004 12:29 PM
Simple IPTables... Want to pass all data from one external IP to an internal IP AdamRankin Linux - Networking 3 04-01-2003 04:24 AM


All times are GMT -5. The time now is 09:28 PM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration