Re: driver copy_to_user

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!

On 16:18 Fri 17 Dec     , Hemanth Kumar wrote:
> Hi All,
> 
>           In my driver code I have interrupt which is exactly 1 sec(gps-pps),
>           I want the data to be copied (copy_to_user) to the user space through read function,After the elapse of interrupt(1 sec gps-pps),how do I instantiate read function after elapse interrupt,Can anybody please share idea,
> 
> Regards

You cannot just call copy_to_user to dump your data somewhere to userspace.
First you need to some some kind of kernel-userspace interface, e.g. a
character device. The user space program could then open() it and do a
read() to wait for some data. On the kernel side, you have to define and
register a function, which gets called by the user space - in this case
the counterpart of read(). If this function gets called, a buffer will be
passed to you. You can then copy the data to this buffer with copy_to_user.
But do *not* call this function in a interrupt handler or anywhere else. It
*has* to be called inside your read() function or a function directly or
indirectly called by it. If you receive the data only in your interrupt
function, you may have to put the data in a queue which will then be read in
your the read() function.

	-Michi
-- 
programing a layer 3+4 network protocol for mesh networks
see http://michaelblizek.twilightparadox.com


--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux