Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - General
User Name
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.


  Search this Thread
Old 08-15-2006, 04:03 AM   #1
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?



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 11:42 AM
How to pass data from one apllication to another. Darkeye Linux - Software 6 10-17-2005 01:10 AM
How to pass data to a console program with multiple inputs? juanbobo Programming 3 08-18-2005 06:39 PM
Pass data between windows agallant Programming 3 10-21-2004 11:29 AM
Simple IPTables... Want to pass all data from one external IP to an internal IP AdamRankin Linux - Networking 3 04-01-2003 03:24 AM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:59 AM.

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