Re: [patch 6/6] staging: speakup: Migrate acntsa, bns, dectlk and txprt to ttyio

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
_______________________________________________
Speakup mailing list
Speakup@xxxxxxxxxxxxxxxxx
http://linux-speakup.org/cgi-bin/mailman/listinfo/speakup




[Index of Archives]     [Linux for the Blind]     [Fedora Discussioin]     [Linux Kernel]     [Yosemite News]     [Big List of Linux Books]
  Powered by Linux