View | Details | Raw Unified | Return to bug 52104
Collapse All | Expand All

(-)a/drivers/acorn/char/defkeymap-l7200.c (-1 / +1 lines)
Lines 346-352 Link Here
346
	0,
346
	0,
347
};
347
};
348
348
349
struct kbdiacr accent_table[MAX_DIACR] = {
349
struct kbdiacruc accent_table[MAX_DIACR] = {
350
	{'`', 'A', '\300'},	{'`', 'a', '\340'},
350
	{'`', 'A', '\300'},	{'`', 'a', '\340'},
351
	{'\'', 'A', '\301'},	{'\'', 'a', '\341'},
351
	{'\'', 'A', '\301'},	{'\'', 'a', '\341'},
352
	{'^', 'A', '\302'},	{'^', 'a', '\342'},
352
	{'^', 'A', '\302'},	{'^', 'a', '\342'},
(-)a/drivers/char/defkeymap.c_shipped (-1 / +1 lines)
Lines 222-228 Link Here
222
	0,
222
	0,
223
};
223
};
224
224
225
struct kbdiacr accent_table[MAX_DIACR] = {
225
struct kbdiacruc accent_table[MAX_DIACR] = {
226
	{'`', 'A', '\300'},	{'`', 'a', '\340'},
226
	{'`', 'A', '\300'},	{'`', 'a', '\340'},
227
	{'\'', 'A', '\301'},	{'\'', 'a', '\341'},
227
	{'\'', 'A', '\301'},	{'\'', 'a', '\341'},
228
	{'^', 'A', '\302'},	{'^', 'a', '\342'},
228
	{'^', 'A', '\302'},	{'^', 'a', '\342'},
(-)a/drivers/char/keyboard.c (-10 / +24 lines)
Lines 331-337 Link Here
331
 * in utf-8 already. UTF-8 is defined for words of up to 31 bits,
331
 * in utf-8 already. UTF-8 is defined for words of up to 31 bits,
332
 * but we need only 16 bits here
332
 * but we need only 16 bits here
333
 */
333
 */
334
void to_utf8(struct vc_data *vc, ushort c) 
334
void to_utf8(struct vc_data *vc, unsigned int c) 
335
{
335
{
336
	if (c < 0x80)
336
	if (c < 0x80)
337
		/*  0******* */
337
		/*  0******* */
Lines 387-399 Link Here
387
}
387
}
388
388
389
/*
389
/*
390
 * We have a combining character DIACR here, followed by the character CH.
390
 * We have a combining character DIACR here, followed by the character CH.  If
391
 * If the combination occurs in the table, return the corresponding value.
391
 * the combination occurs in the table, return the corresponding UCS2 value.
392
 * Otherwise, if CH is a space or equals DIACR, return DIACR.
392
 * Otherwise, if CH is a space or equals DIACR, return DIACR.  Otherwise,
393
 * Otherwise, conclude that DIACR was not combining after all,
393
 * conclude that DIACR was not combining after all, queue it and return CH.
394
 * queue it and return CH.
395
 */
394
 */
396
unsigned char handle_diacr(struct vc_data *vc, unsigned char ch)
395
unsigned int handle_diacr(struct vc_data *vc, unsigned char ch)
397
{
396
{
398
	int d = diacr;
397
	int d = diacr;
399
	int i;
398
	int i;
Lines 616-626 Link Here
616
615
617
static void k_self(struct vc_data *vc, unsigned char value, char up_flag, struct pt_regs *regs)
616
static void k_self(struct vc_data *vc, unsigned char value, char up_flag, struct pt_regs *regs)
618
{
617
{
618
	unsigned int v;
619
620
619
	if (up_flag)
621
	if (up_flag)
620
		return;		/* no action, if this is a key release */
622
		return;		/* no action, if this is a key release */
621
623
622
	if (diacr)
624
	if (diacr) {
623
		value = handle_diacr(vc, value);
625
		v = handle_diacr(vc, value);
626
627
		if (kbd->kbdmode == VC_UNICODE) {
628
			to_utf8(vc, v & 0xFFFF);
629
			return;
630
		}
631
632
		/* 
633
		 * this makes at least latin-1 compose chars work 
634
		 * even when using unicode keymap in non-unicode mode
635
		 */
636
		value = v & 0xFF; 
637
	}
624
638
625
	if (dead_key_next) {
639
	if (dead_key_next) {
626
		dead_key_next = 0;
640
		dead_key_next = 0;
Lines 639-645 Link Here
639
{
653
{
640
	if (up_flag)
654
	if (up_flag)
641
		return;
655
		return;
642
	diacr = (diacr ? handle_diacr(vc, value) : value);
656
	diacr = (diacr ? handle_diacr(vc, value) & 0xff : value);
643
}
657
}
644
658
645
/*
659
/*
(-)a/drivers/char/qtronixmap.c_shipped (-1 / +1 lines)
Lines 225-231 Link Here
225
	0,
225
	0,
226
};
226
};
227
227
228
struct kbdiacr accent_table[MAX_DIACR] = {
228
struct kbdiacruc accent_table[MAX_DIACR] = {
229
	{'`', 'A', 'À'},	{'`', 'a', 'à'},
229
	{'`', 'A', 'À'},	{'`', 'a', 'à'},
230
	{'\'', 'A', 'Á'},	{'\'', 'a', 'á'},
230
	{'\'', 'A', 'Á'},	{'\'', 'a', 'á'},
231
	{'^', 'A', 'Â'},	{'^', 'a', 'â'},
231
	{'^', 'A', 'Â'},	{'^', 'a', 'â'},
(-)a/drivers/char/vt_ioctl.c (-2 / +44 lines)
Lines 584-593 Link Here
584
	case KDGKBDIACR:
584
	case KDGKBDIACR:
585
	{
585
	{
586
		struct kbdiacrs *a = (struct kbdiacrs *)arg;
586
		struct kbdiacrs *a = (struct kbdiacrs *)arg;
587
		struct kbdiacr diacr;
588
		int i;
587
589
588
		if (put_user(accent_table_size, &a->kb_cnt))
590
		if (put_user(accent_table_size, &a->kb_cnt))
589
			return -EFAULT;
591
			return -EFAULT;
590
		if (copy_to_user(a->kbdiacr, accent_table, accent_table_size*sizeof(struct kbdiacr)))
592
		for (i = 0; i < accent_table_size; i++) {
593
			diacr.diacr = accent_table[i].diacr;
594
			diacr.base = accent_table[i].base;
595
			diacr.result = accent_table[i].result> 0xff ? 0 : accent_table[i].base;
596
			if (copy_to_user(a->kbdiacr + i, &diacr, sizeof(struct kbdiacr)))
597
				return -EFAULT;
598
		}
599
		return 0;
600
	}
601
602
	case KDGKBDIACRUC:
603
	{
604
		struct kbdiacrsuc *a = (struct kbdiacrsuc *)arg;
605
606
		if (put_user(accent_table_size, &a->kb_cnt))
607
			return -EFAULT;
608
		if (copy_to_user(a->kbdiacruc, accent_table, accent_table_size*sizeof(struct kbdiacruc)))
591
			return -EFAULT;
609
			return -EFAULT;
592
		return 0;
610
		return 0;
593
	}
611
	}
Lines 595-600 Link Here
595
	case KDSKBDIACR:
613
	case KDSKBDIACR:
596
	{
614
	{
597
		struct kbdiacrs *a = (struct kbdiacrs *)arg;
615
		struct kbdiacrs *a = (struct kbdiacrs *)arg;
616
		struct kbdiacr diacr;
617
		unsigned int ct;
618
		int i;
619
620
		if (!perm)
621
			return -EPERM;
622
		if (get_user(ct,&a->kb_cnt))
623
			return -EFAULT;
624
		if (ct >= MAX_DIACR)
625
			return -EINVAL;
626
		accent_table_size = ct;
627
		for (i = 0; i < ct; i++) {
628
			if (copy_from_user(&diacr, a->kbdiacr, sizeof(struct kbdiacr)))
629
				return -EFAULT;
630
			accent_table[i].diacr = diacr.diacr;
631
			accent_table[i].base = diacr.base;
632
			accent_table[i].result = diacr.result;
633
		}
634
		return 0;
635
	}
636
637
	case KDSKBDIACRUC:
638
	{
639
		struct kbdiacrsuc *a = (struct kbdiacrsuc *)arg;
598
		unsigned int ct;
640
		unsigned int ct;
599
641
600
		if (!perm)
642
		if (!perm)
Lines 604-610 Link Here
604
		if (ct >= MAX_DIACR)
646
		if (ct >= MAX_DIACR)
605
			return -EINVAL;
647
			return -EINVAL;
606
		accent_table_size = ct;
648
		accent_table_size = ct;
607
		if (copy_from_user(accent_table, a->kbdiacr, ct*sizeof(struct kbdiacr)))
649
		if (copy_from_user(accent_table, a->kbdiacruc, ct*sizeof(struct kbdiacruc)))
608
			return -EFAULT;
650
			return -EFAULT;
609
		return 0;
651
		return 0;
610
	}
652
	}
(-)a/drivers/s390/char/defkeymap.c (-1 / +1 lines)
Lines 148-154 Link Here
148
	0,
148
	0,
149
};
149
};
150
150
151
struct kbdiacr accent_table[MAX_DIACR] = {
151
struct kbdiacruc accent_table[MAX_DIACR] = {
152
	{'^', 'c', '\003'},	{'^', 'd', '\004'},
152
	{'^', 'c', '\003'},	{'^', 'd', '\004'},
153
	{'^', 'z', '\032'},	{'^', '\012', '\000'},
153
	{'^', 'z', '\032'},	{'^', '\012', '\000'},
154
};
154
};
(-)a/drivers/s390/char/keyboard.c (-13 / +54 lines)
Lines 87-97 Link Here
87
		goto out_func;
87
		goto out_func;
88
	memset(kbd->fn_handler, 0, sizeof(fn_handler_fn *) * NR_FN_HANDLER);
88
	memset(kbd->fn_handler, 0, sizeof(fn_handler_fn *) * NR_FN_HANDLER);
89
	kbd->accent_table =
89
	kbd->accent_table =
90
		kmalloc(sizeof(struct kbdiacr)*MAX_DIACR, GFP_KERNEL);
90
		kmalloc(sizeof(struct kbdiacruc)*MAX_DIACR, GFP_KERNEL);
91
	if (!kbd->accent_table)
91
	if (!kbd->accent_table)
92
		goto out_fn_handler;
92
		goto out_fn_handler;
93
	memcpy(kbd->accent_table, accent_table,
93
	memcpy(kbd->accent_table, accent_table,
94
	       sizeof(struct kbdiacr)*MAX_DIACR);
94
	       sizeof(struct kbdiacruc)*MAX_DIACR);
95
	kbd->accent_table_size = accent_table_size;
95
	kbd->accent_table_size = accent_table_size;
96
	return kbd;
96
	return kbd;
97
97
Lines 464-470 Link Here
464
kbd_ioctl(struct kbd_data *kbd, struct file *file,
464
kbd_ioctl(struct kbd_data *kbd, struct file *file,
465
	  unsigned int cmd, unsigned long arg)
465
	  unsigned int cmd, unsigned long arg)
466
{
466
{
467
	struct kbdiacrs *a;
468
	int ct, perm;
467
	int ct, perm;
469
468
470
	/*
469
	/*
Lines 482-509 Link Here
482
	case KDSKBSENT:
481
	case KDSKBSENT:
483
		return do_kdgkb_ioctl(kbd, (struct kbsentry *)arg, cmd, perm);
482
		return do_kdgkb_ioctl(kbd, (struct kbsentry *)arg, cmd, perm);
484
	case KDGKBDIACR:
483
	case KDGKBDIACR:
485
		a = (struct kbdiacrs *) arg;
484
	{
485
		struct kbdiacrs *a = (struct kbdiacrs *)arg;
486
		struct kbdiacr diacr;
487
		int i;
486
488
487
		if (put_user(kbd->accent_table_size, &a->kb_cnt))
489
		if (put_user(accent_table_size, &a->kb_cnt))
488
			return -EFAULT;
490
			return -EFAULT;
489
		ct = kbd->accent_table_size;
491
		for (i = 0; i < accent_table_size; i++) {
490
		if (copy_to_user(a->kbdiacr, kbd->accent_table,
492
			diacr.diacr = accent_table[i].diacr;
491
				 ct * sizeof(struct kbdiacr)))
493
			diacr.base = accent_table[i].base;
494
			diacr.result = accent_table[i].base > 0xff ? 0 : accent_table[i].base;
495
			if (copy_to_user(a->kbdiacr + i, &diacr, sizeof(struct kbdiacr)))
496
				return -EFAULT;
497
		}
498
		return 0;
499
	}
500
	case KDGKBDIACRUC:
501
	{
502
		struct kbdiacrsuc *a = (struct kbdiacrsuc *)arg;
503
504
		if (put_user(accent_table_size, &a->kb_cnt))
505
			return -EFAULT;
506
		if (copy_to_user(a->kbdiacruc, accent_table, accent_table_size*sizeof(struct kbdiacruc)))
492
			return -EFAULT;
507
			return -EFAULT;
493
		return 0;
508
		return 0;
509
	}
494
	case KDSKBDIACR:
510
	case KDSKBDIACR:
495
		a = (struct kbdiacrs *) arg;
511
	{
512
		struct kbdiacrs *a = (struct kbdiacrs *)arg;
513
		struct kbdiacr diacr;
514
		int i;
515
496
		if (!perm)
516
		if (!perm)
497
			return -EPERM;
517
			return -EPERM;
498
		if (get_user(ct, &a->kb_cnt))
518
		if (get_user(ct,&a->kb_cnt))
499
			return -EFAULT;
519
			return -EFAULT;
500
		if (ct >= MAX_DIACR)
520
		if (ct >= MAX_DIACR)
501
			return -EINVAL;
521
			return -EINVAL;
502
		kbd->accent_table_size = ct;
522
		accent_table_size = ct;
503
		if (copy_from_user(kbd->accent_table, a->kbdiacr,
523
		for (i = 0; i < ct; i++) {
504
				   ct * sizeof(struct kbdiacr)))
524
			if (copy_from_user(&diacr, a->kbdiacr, sizeof(struct kbdiacr)))
525
				return -EFAULT;
526
			accent_table[i].diacr = diacr.diacr;
527
			accent_table[i].base = diacr.base;
528
			accent_table[i].result = diacr.result;
529
		}
530
		return 0;
531
	}
532
	case KDSKBDIACRUC:
533
	{
534
		struct kbdiacrsuc *a = (struct kbdiacrsuc *)arg;
535
		unsigned int ct;
536
537
		if (!perm)
538
			return -EPERM;
539
		if (get_user(ct,&a->kb_cnt))
540
			return -EFAULT;
541
		if (ct >= MAX_DIACR)
542
			return -EINVAL;
543
		accent_table_size = ct;
544
		if (copy_from_user(accent_table, a->kbdiacruc, ct*sizeof(struct kbdiacruc)))
505
			return -EFAULT;
545
			return -EFAULT;
506
		return 0;
546
		return 0;
547
	}
507
	default:
548
	default:
508
		return -ENOIOCTLCMD;
549
		return -ENOIOCTLCMD;
509
	}
550
	}
(-)a/drivers/s390/char/keyboard.h (-1 / +1 lines)
Lines 25-31 Link Here
25
	unsigned short **key_maps;
25
	unsigned short **key_maps;
26
	char **func_table;
26
	char **func_table;
27
	fn_handler_fn **fn_handler;
27
	fn_handler_fn **fn_handler;
28
	struct kbdiacr *accent_table;
28
	struct kbdiacruc *accent_table;
29
	unsigned int accent_table_size;
29
	unsigned int accent_table_size;
30
	unsigned char diacr;
30
	unsigned char diacr;
31
	unsigned short sysrq;
31
	unsigned short sysrq;
(-)a/drivers/tc/lk201-map.c_shipped (-1 / +1 lines)
Lines 225-231 Link Here
225
	0,
225
	0,
226
};
226
};
227
227
228
struct kbdiacr accent_table[MAX_DIACR] = {
228
struct kbdiacruc accent_table[MAX_DIACR] = {
229
	{'`', 'A', 'À'},	{'`', 'a', 'à'},
229
	{'`', 'A', 'À'},	{'`', 'a', 'à'},
230
	{'\'', 'A', 'Á'},	{'\'', 'a', 'á'},
230
	{'\'', 'A', 'Á'},	{'\'', 'a', 'á'},
231
	{'^', 'A', 'Â'},	{'^', 'a', 'â'},
231
	{'^', 'A', 'Â'},	{'^', 'a', 'â'},
(-)a/include/linux/kbd_diacr.h (-1 / +1 lines)
Lines 2-8 Link Here
2
#define _DIACR_H
2
#define _DIACR_H
3
#include <linux/kd.h>
3
#include <linux/kd.h>
4
4
5
extern struct kbdiacr accent_table[];
5
extern struct kbdiacruc accent_table[];
6
extern unsigned int accent_table_size;
6
extern unsigned int accent_table_size;
7
7
8
#endif /* _DIACR_H */
8
#endif /* _DIACR_H */
(-)a/include/linux/kd.h (+14 lines)
Lines 121-132 Link Here
121
        unsigned int kb_cnt;    /* number of entries in following array */
121
        unsigned int kb_cnt;    /* number of entries in following array */
122
	struct kbdiacr kbdiacr[256];    /* MAX_DIACR from keyboard.h */
122
	struct kbdiacr kbdiacr[256];    /* MAX_DIACR from keyboard.h */
123
};
123
};
124
124
#define KDGKBDIACR      0x4B4A  /* read kernel accent table */
125
#define KDGKBDIACR      0x4B4A  /* read kernel accent table */
125
#define KDSKBDIACR      0x4B4B  /* write kernel accent table */
126
#define KDSKBDIACR      0x4B4B  /* write kernel accent table */
126
127
128
struct kbdiacruc {
129
        unsigned char diacr, base;
130
	unsigned int result;	/* UCS */
131
};
132
struct kbdiacrsuc {
133
        unsigned int kb_cnt;    /* number of entries in following array */
134
	struct kbdiacruc kbdiacruc[256];    /* MAX_DIACR from keyboard.h */
135
};
136
137
#define KDGKBDIACRUC    0x4BFA  /* read kernel accent table - UCS */
138
#define KDSKBDIACRUC    0x4BFB  /* write kernel accent table  - UCS */
139
127
struct kbkeycode {
140
struct kbkeycode {
128
	unsigned int scancode, keycode;
141
	unsigned int scancode, keycode;
129
};
142
};
143
130
#define KDGETKEYCODE	0x4B4C	/* read kernel keycode table entry */
144
#define KDGETKEYCODE	0x4B4C	/* read kernel keycode table entry */
131
#define KDSETKEYCODE	0x4B4D	/* write kernel keycode table entry */
145
#define KDSETKEYCODE	0x4B4D	/* write kernel keycode table entry */
132
146

Return to bug 52104