writing and reading driver value in ioctl
I just want to read and write some values (integer) to my driver. I used put/get user but always getting errors.
driver Quote:
C++ Quote:
the returnvalue of get and put user is -1 so it failed. what did i wrong? |
Read this:
Quote:
Check the value of EFAULT. |
i also tried
Quote:
how do i make WERT assignable??? |
That would obviously not make any difference, I was referring to: (int __user *)arg)
Did you check the value of EFAULT? |
EFAULT is -1
|
Put EFAULT in Google and read the first link.
|
It says
"You should check your pointers are properly initialised." ok so how to initialise a pointer properly? |
<irrelevant deleted>
|
http://lxr.free-electrons.com/source...wdt.c?v=2.6.28
thats the origanal driver from AMD i want to use but i dont get it how to use the get and put §!#$ 133 static long geodewdt_ioctl(struct file *file, unsigned int cmd, 134 unsigned long arg) 135 { 136 void __user *argp = (void __user *)arg; 137 int __user *p = argp; 138 int interval; ... 180 case WDIOC_SETTIMEOUT: 181 if (get_user(interval, p)) 182 return -EFAULT; 183 184 if (geodewdt_set_heartbeat(interval)) 185 return -EINVAL; 186 /* Fall through */ 187 case WDIOC_GETTIMEOUT: 188 return put_user(timeout, p); |
Code:
void __user *argp = (void __user *)arg; |
even if i use the origanal code it doesnt work as it should.
I tried this Quote:
Quote:
Quote:
Quote:
|
and it was so easy. SOLVED
Quote:
|
Ahh, well yes, I was not observant enough :doh: Thanks for posting the solution.
|
All times are GMT -5. The time now is 09:28 PM. |