[patch 6/6] staging: speakup: Migrate acntsa, bns, dectlk and txprt to ttyio
Samuel Thibault
samuel.thibault at ens-lyon.org
Sat Feb 25 21:48:32 EST 2017
Samuel Thibault, on dim. 26 févr. 2017 02:50:05 +0100, wrote:
> Please note in your todo for the input part, that ttyio will have to
> call read_buff_add for each received character, when that method is
> not NULL (that's actually the only driver using it, so we will really
> need a tester for this exact driver).
More precisely, it's the spk_ttyio_ldisc_ops->receive_buf2 method which
should call read_buff_add for each received character.
The step further will be implementing spk_ttyio_in and
spk_ttyio_in_nowait. I believe the easiest way is the following:
- define an spk_ldisc_data structure containing just one character (buf),
and a semaphore.
- on ldisc_open, allocate a pointer to such structure, set
tty->disc_data to point to it, and initialized the semaphore to 0
tokens.
- in the receive_buf2 method,
- if read_buff_add is defined, just call it for each character and be
done
- otherwise, store the first received character in
((struct spk_ldisc_data *)tty->disc_data)->buf
, call up() on the semaphore, and return 1 (to tell that you ate the
character).
- in spk_serial_in, call down_timeout(usecs_to_jiffies(SPK_SERIAL_TIMEOUT)),
- on success, copy the character stored in buf, then call tty_schedule_flip() and return the copy
- on failure (timed out), return 0xff.
- in spk_serial_in_nowait, call down_trylock(),
- on success, copy the character stored in buf, then call tty_schedule_flip() and return the copy
- on failure, return 0.
Samuel
More information about the Speakup
mailing list