Timeline for Writing a simple misc char device driver with read and write operations
Current License: CC BY-SA 4.0
8 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jun 20, 2020 at 8:15 | vote | accept | thatbangaloreanguy | ||
| Jun 20, 2020 at 1:00 | comment | added | thatbangaloreanguy | Right, my bad. Thank you for pointing it out for me. | |
| Jun 19, 2020 at 22:02 | comment | added | icarus |
The reason it should give an I/O error is because you told us that it is specified to do so! The original "complicated" code will do so, for example if you ask it to read less than the full length of the string. Usually people want what the simple_read_from_buffer provides, i.e. if you ask for only part of the string you get just part. You said that it had to produce "nothing less than the full string". so the only thing you can do if you are asked for part of the string is to return an error.
|
|
| Jun 19, 2020 at 14:00 | comment | added | thatbangaloreanguy |
No, it did not. Do you mind telling me why you expected an I/O error of some sort? Fri Jun 19 07:29:21 bkkarthik <2003> ~/Workspace/mydevice01 $ dd bs=1 seek=2 count=3 if=/dev/mydevice01 jbsdkj a243+0 records in 3+0 records out Please bear with me, I'm new to kernel programming.
|
|
| Jun 18, 2020 at 23:49 | comment | added | icarus |
dd bs=1 seek=2 count=3 if=/dev/mydevice01 according to your specification should give an I/O error of some kind.
|
|
| Jun 18, 2020 at 14:15 | comment | added | thatbangaloreanguy |
I might not have noticed that, but this seemed like a valid solution for a single line code to help me obtain TEXT when I say cat /dev/mydevice01. Thank you for the help Icarus :) Much appreciated.
|
|
| Jun 18, 2020 at 14:12 | comment | added | icarus |
simple_read_from_buffer doesn't do what you said in the comments you required it to do, in particular it allows partial reads so you can read from part way through the string and don't have to read all the string.
|
|
| Jun 18, 2020 at 9:03 | history | answered | thatbangaloreanguy | CC BY-SA 4.0 |