speakupconf and trailing blank lines in files under parameters/

Chris Brannon cmbrannon at cox.net
Sat May 23 20:37:12 EDT 2009

Chuck Hallenbeck and I were talking about speakupconf earlier today, and
he pointed out that most of the files under
/sys/module/speakup/parameters end in a blank line.
You can actually see the blank lines when you cat the files.
This is causing trouble for speakupconf.
I had a look at other modules that provide a parameters/ subdirectory, and
none of their files end in a blank line.  Next, I looked at
kernel/params.c, from my copy of the kernel source tree.
That file provides some param_get_* functions that are called when a user reads
data from a "parameter" file under /sys.  They resemble the get_* functions
in src/paramhelpers.c from the Speakup source tree, with one exception.
Most of Speakup's get_* functions put a newline at the end of the buffer
to which they write, but the ones in kernel/params.c do not.
Thus, most of Speakup's parameter/ files end in a blank line.

I have a patch to fix this, and I'll send it after some testing.

If you want to see how this issue affects speakupconf, execute the
speakupconf save
cp ~/.speakup/SYNTHNAME/keymap /sys/module/speakup/parameters/keymap

cp terminates with an "invalid argument" error from a call to write.
Next, remove the blank line from the end of ~/.speakup/SYNTHNAME/keymap,
and try the same cp invocation.  It succeeds.
(Note: SYNTHNAME is the name of your synth, E.G., soft.)

-- Chris

More information about the Speakup mailing list