aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2016-01-24 19:32:08 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-01-29 01:55:40 -0500
commit88867e3d0b7eea256c1cd432b0a3c7a21e8edf07 (patch)
treefb27b916e4ffd00f5cdafd690982d5fbeb7670f2
parent327b882d3bcc1fba82dbd39b5cf5a838c81218e2 (diff)
Staging: speakup: fix read scrolled-back VT
Previously, speakup would always read the non-scrolled part of the VT, even when the VT is scrolled back with shift-page. This patch makes vt.c export screen_pos so that speakup can use it to properly access the content of the scrolled-back VT. This was tested with both vgacon and fbcon. Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Reviewed-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/speakup/main.c21
-rw-r--r--drivers/tty/vt/vt.c1
2 files changed, 14 insertions, 8 deletions
diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c
index 63c59bc89b04..30cf973f326d 100644
--- a/drivers/staging/speakup/main.c
+++ b/drivers/staging/speakup/main.c
@@ -264,8 +264,9 @@ static struct notifier_block vt_notifier_block = {
264 .notifier_call = vt_notifier_call, 264 .notifier_call = vt_notifier_call,
265}; 265};
266 266
267static unsigned char get_attributes(u16 *pos) 267static unsigned char get_attributes(struct vc_data *vc, u16 *pos)
268{ 268{
269 pos = screen_pos(vc, pos - (u16 *)vc->vc_origin, 1);
269 return (u_char) (scr_readw(pos) >> 8); 270 return (u_char) (scr_readw(pos) >> 8);
270} 271}
271 272
@@ -275,7 +276,7 @@ static void speakup_date(struct vc_data *vc)
275 spk_y = spk_cy = vc->vc_y; 276 spk_y = spk_cy = vc->vc_y;
276 spk_pos = spk_cp = vc->vc_pos; 277 spk_pos = spk_cp = vc->vc_pos;
277 spk_old_attr = spk_attr; 278 spk_old_attr = spk_attr;
278 spk_attr = get_attributes((u_short *) spk_pos); 279 spk_attr = get_attributes(vc, (u_short *)spk_pos);
279} 280}
280 281
281static void bleep(u_short val) 282static void bleep(u_short val)
@@ -469,8 +470,12 @@ static u16 get_char(struct vc_data *vc, u16 *pos, u_char *attribs)
469 u16 ch = ' '; 470 u16 ch = ' ';
470 471
471 if (vc && pos) { 472 if (vc && pos) {
472 u16 w = scr_readw(pos); 473 u16 w;
473 u16 c = w & 0xff; 474 u16 c;
475
476 pos = screen_pos(vc, pos - (u16 *)vc->vc_origin, 1);
477 w = scr_readw(pos);
478 c = w & 0xff;
474 479
475 if (w & vc->vc_hi_font_mask) 480 if (w & vc->vc_hi_font_mask)
476 c |= 0x100; 481 c |= 0x100;
@@ -746,7 +751,7 @@ static int get_line(struct vc_data *vc)
746 u_char tmp2; 751 u_char tmp2;
747 752
748 spk_old_attr = spk_attr; 753 spk_old_attr = spk_attr;
749 spk_attr = get_attributes((u_short *) spk_pos); 754 spk_attr = get_attributes(vc, (u_short *)spk_pos);
750 for (i = 0; i < vc->vc_cols; i++) { 755 for (i = 0; i < vc->vc_cols; i++) {
751 buf[i] = (u_char) get_char(vc, (u_short *) tmp, &tmp2); 756 buf[i] = (u_char) get_char(vc, (u_short *) tmp, &tmp2);
752 tmp += 2; 757 tmp += 2;
@@ -811,7 +816,7 @@ static int say_from_to(struct vc_data *vc, u_long from, u_long to,
811 u_short saved_punc_mask = spk_punc_mask; 816 u_short saved_punc_mask = spk_punc_mask;
812 817
813 spk_old_attr = spk_attr; 818 spk_old_attr = spk_attr;
814 spk_attr = get_attributes((u_short *) from); 819 spk_attr = get_attributes(vc, (u_short *)from);
815 while (from < to) { 820 while (from < to) {
816 buf[i++] = (char)get_char(vc, (u_short *) from, &tmp); 821 buf[i++] = (char)get_char(vc, (u_short *) from, &tmp);
817 from += 2; 822 from += 2;
@@ -886,7 +891,7 @@ static int get_sentence_buf(struct vc_data *vc, int read_punc)
886 sentmarks[bn][0] = &sentbuf[bn][0]; 891 sentmarks[bn][0] = &sentbuf[bn][0];
887 i = 0; 892 i = 0;
888 spk_old_attr = spk_attr; 893 spk_old_attr = spk_attr;
889 spk_attr = get_attributes((u_short *) start); 894 spk_attr = get_attributes(vc, (u_short *)start);
890 895
891 while (start < end) { 896 while (start < end) {
892 sentbuf[bn][i] = (char)get_char(vc, (u_short *) start, &tmp); 897 sentbuf[bn][i] = (char)get_char(vc, (u_short *) start, &tmp);
@@ -1585,7 +1590,7 @@ static int count_highlight_color(struct vc_data *vc)
1585 u16 *ptr; 1590 u16 *ptr;
1586 1591
1587 for (ptr = start; ptr < end; ptr++) { 1592 for (ptr = start; ptr < end; ptr++) {
1588 ch = get_attributes(ptr); 1593 ch = get_attributes(vc, ptr);
1589 bg = (ch & 0x70) >> 4; 1594 bg = (ch & 0x70) >> 4;
1590 speakup_console[vc_num]->ht.bgcount[bg]++; 1595 speakup_console[vc_num]->ht.bgcount[bg]++;
1591 } 1596 }
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index 4462d167900c..12210dab9ab1 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -4250,6 +4250,7 @@ unsigned short *screen_pos(struct vc_data *vc, int w_offset, int viewed)
4250{ 4250{
4251 return screenpos(vc, 2 * w_offset, viewed); 4251 return screenpos(vc, 2 * w_offset, viewed);
4252} 4252}
4253EXPORT_SYMBOL_GPL(screen_pos);
4253 4254
4254void getconsxy(struct vc_data *vc, unsigned char *p) 4255void getconsxy(struct vc_data *vc, unsigned char *p)
4255{ 4256{