Parallel port write fails occasionally, succeeds always on next write.
root@debian1:/ldd3-samples/short# echo -n "0" > /dev/short0
bash: echo: write error: Operation not permitted
root@debian1:/ldd3-samples/short# echo -n "0" > /dev/short0
root@debian1:/ldd3-samples/short# echo -n "0" > /dev/short0
[ 3749.614133] short: init, req region OK
[ 3749.614528] short: init registered irq [7]
[ 3749.614534] short: init, irq [7] base [888] use_mem [0] major [250] probe [0] share [0]
[ 3774.100000] short: cleanup
[ 3840.883497] short: init, req region OK
[ 3840.883623] short: init registered irq [7]
[ 3840.883625] short: init, irq [7] base [53248] use_mem [0] major [250] probe [0] share [0]
[ 4145.343071] short: do_short_write value error
[ 4149.304409] short: write, val [1], port [53248]
[ 4165.372757] short: do_short_write value error
[ 4167.002722] short: write, val [2], port [53248]
Fix
if (kstrtouint(kbuf, 10, &val) != 0 || val > 255) {
-
printk("short: do_short_write value error\n");
-
- }