The OpenNET Project / Index page

[ новости /+++ | форум | теги | ]

Индикатоp кодиpовки (patch charset)


<< Предыдущая ИНДЕКС Поиск в статьях src Установить закладку Перейти на закладку Следующая >>
Ключевые слова: patch, charset,  (найти похожие документы)
_ RU.LINUX (2:5077/15.22) ___________________________________________ RU.LINUX _ From : Igor Kopylov 2:5020/1188.26 12 May 98 15:27:14 Subj : Re: Индикатоp кодиpовки ________________________________________________________________________________ Приветствую тебя, All! По пpоcьбам тpyдящиxcя маcc,
* Forwarded by Igor Kopylov (2:5020/1188.26) * Area : #NETMAIL * From : Serg Oskin, 2:5020/20@fidonet (Пятница Май 08 1998 19:57) * To : Igor.Kopylov * Subj : Re: Индикатоp кодиpовки
In article <894554684@p26.f1188.n5020.z2.ftn>, Igor Kopylov <Igor.Kopylov@p26.f1188.n5020.z2.fidonet.org> writes: > Приветствую тебя, All! > > Kто делал или знает как делаетcя - индикатоp RUS/LAT как cделать? > Боpдюpчиком цветным чтоб или еще как нибyдь показывал. Вот завалялось, для 2.x.x сам докрутишь. :)
Hello! There is a linux-2.0.18 console patch for displaying AltGr keyboard state as console color border (an additional led). You can swap scroll lock and AltGr leds. This is useful for Cyrillic, Greek and others, who use AltGr keyboard lock state to enter chars from 128..255 range. Regards, Sergey Ya. Korshunoff p5.f434.n5020.z2.fidonet.org PS: Thanks Vladimir Goncharov and Seva Semenov for support. - ---8<------------------------------------------->8------------------- /* * con_border.c - console border configuration * ( Sergey_Korshunoff@p5.f434.n5020.fidonet.org, 1997/03/09 ) */ #include <sys/kd.h> #include <stdio.h> int main(int argc, char *argv[]) { int fd; unsigned char parms[4] = { 1, 4, 0, 0 }; if (argc < 2) { fprintf(stderr, "Linux console border configuration.\n"); fprintf(stderr, "By default used as additional led to display AltGr keyboard state.\n"); fprintf(stderr, "usage: %s num1 [num2 [num3 [num4]]]\n",argv[0]); fprintf(stderr, " num1 - enable/disable console border (1/0)\n"); fprintf(stderr, " num2 - color for 'on' state (0..255)\n"); fprintf(stderr, " num3 - color for 'off' state (0..255)\n"); fprintf(stderr, " num4 - swap scroll lock and AltGr leds (1/0)\n"); exit(1); } if ((fd = open("/dev/console", 0)) < 0) fd = 0; if (argc > 1 ) parms[0] = atoi(argv[1]); if (argc > 2 ) parms[1] = atoi(argv[2]); if (argc > 3 ) parms[2] = atoi(argv[3]); if (argc > 4 ) parms[3] = atoi(argv[4]); if (ioctl(fd,KD_SET_BORDER,parms)) { perror("KD_SET_BORDER"); exit(1); } else { fprintf(stderr,"OK\n"); exit(0); } } - ---8<------------------------------------------->8------------------- # console border as aditional led for displaying AltGr keyboard state # - --- linux/include/linux/kd.h.old Sun Mar 9 21:23:50 1997 +++ linux/include/linux/kd.h Sun Mar 9 21:25:15 1997 @@ -131,9 +131,10 @@ #define KDSETKEYCODE 0x4B4D /* write kernel keycode table entry */ #define KDSIGACCEPT 0x4B4E /* accept kbd generated signals */ +#define KD_SET_BORDER 0x4B4F /* configure console border */ /* note: 0x4B00-0x4B4E all have had a value at some time; don't reuse for the time being */ -/* note: 0x4B60-0x4B6D, 0x4B70, 0x4B71 used above */ +/* note: 0x4B4F, 0x4B60-0x4B6D, 0x4B70, 0x4B71 used above */ #endif /* _LINUX_KD_H */ - ---8<------------------------------------------->8------------------- # console border as aditional led for displaying AltGr keyboard state # - --- linux/drivers/char/keyboard.c.old Thu Jul 25 21:24:49 1996 +++ linux/drivers/char/keyboard.c Sun Mar 9 21:39:20 1997 @@ -81,6 +81,11 @@ unsigned char kbd_read_mask = 0x01; /* modified by psaux.c */ +unsigned char con_border_enable = 0; +unsigned char con_border_color1 = 4; +unsigned char con_border_color0 = 0; +unsigned char con_border_swapleds = 0; + /* * global state includes the following, and various static variables * in this module: prev_scancode, shift_state, diacr, npadch, dead_key_next. @@ -1090,7 +1095,7 @@ } /* - * The leds display either (i) the status of NumLock, CapsLock, ScrollLock, + * The leds display either (i) the status of NumLock, CapsLock, ScrollLock, AltGr, * or (ii) whatever pattern of lights people want to show using KDSETLED, * or (iii) specified bits of specified words in kernel memory. */ @@ -1103,7 +1108,7 @@ } void setledstate(struct kbd_struct *kbd, unsigned int led) { - if (!(led & ~7)) { + if (!(led & ~15)) { ledioctl = led; kbd->ledmode = LED_SHOW_IOCTL; } else @@ -1120,7 +1125,7 @@ void register_leds(int console, unsigned int led, unsigned int *addr, unsigned int mask) { struct kbd_struct *kbd = kbd_table + console; - if (led < 3) { + if (led < 4) { ledptrs[led].addr = addr; ledptrs[led].mask = mask; ledptrs[led].valid = 1; @@ -1131,11 +1136,29 @@ static inline unsigned char getleds(void){ struct kbd_struct *kbd = kbd_table + fg_console; + int shift_final = shift_state ^ kbd->lockstate ^ kbd->slockstate; unsigned char leds; + unsigned int scroll_lock, altgr_state; if (kbd->ledmode == LED_SHOW_IOCTL) return ledioctl; + leds = kbd->ledflagstate; + scroll_lock = leds & (1 << VC_SCROLLOCK); + altgr_state = shift_final & (1 << VC_ALTGRLOCK); + + if ( con_border_swapleds ) { + int tmp = scroll_lock; + scroll_lock = altgr_state; + altgr_state = tmp; + } + + if (scroll_lock) leds |= (1 << VC_SCROLLOCK); + else leds &= ~(1 << VC_SCROLLOCK); + + if (altgr_state) leds |= (1 << 3); + else leds &= ~(1 << 3); + if (kbd->ledmode == LED_SHOW_MEM) { if (ledptrs[0].valid) { if (*ledptrs[0].addr & ledptrs[0].mask) @@ -1155,6 +1178,12 @@ else leds &= ~4; } + if (ledptrs[3].valid) { + if (*ledptrs[3].addr & ledptrs[3].mask) + leds |= 8; + else + leds &= ~8; + } } return leds; } @@ -1172,14 +1201,21 @@ * used, but this allows for easy and efficient race-condition * prevention later on. */ + +extern void set_con_border(int color); static void kbd_bh(void) { unsigned char leds = getleds(); if (leds != ledstate) { ledstate = leds; - if (!send_data(0xed) || !send_data(leds)) + if (!send_data(0xed) || !send_data(leds & 0x07)) send_data(0xf4); /* re-enable kbd if any errors */ + if (con_border_enable) + if (leds & 0x08) + set_con_border(con_border_color1); + else + set_con_border(con_border_color0); } } - ---8<------------------------------------------->8------------------- # console border as aditional led for displaying AltGr keyboard state # - --- linux/drivers/char/tga.c.old Sun Mar 9 21:26:17 1997 +++ linux/drivers/char/tga.c Sun Mar 9 21:30:01 1997 @@ -1145,3 +1145,10 @@ 0x00, 0x00, 0x00, 0x00, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +void +set_con_border ( int aColor ) +{ + return ; +} + - ---8<------------------------------------------->8------------------- # console border as aditional led for displaying AltGr keyboard state # - --- linux/drivers/char/vga.c.old Tue May 7 08:50:53 1996 +++ linux/drivers/char/vga.c Sun Mar 9 21:30:01 1997 @@ -20,6 +20,8 @@ * 'int reset_palette(int currcons)' * 'void set_palette(void)' * + * 'void set_con_border(int aColor)' + * * User definable mapping table and font loading by Eugene G. Crosser, * <crosser@pccross.msk.su> * @@ -580,3 +582,17 @@ return -EINVAL; #endif } + +void +set_con_border ( int aColor ) +{ + if (video_type != VIDEO_TYPE_VGAC || console_blanked || + vt_cons[fg_console]->vc_mode == KD_GRAPHICS) + return ; + + inb_p (0x3da) ; + outb_p (0x11, 0x3c0) ; + outb_p (aColor,0x3c0) ; + outb_p (0x20, 0x3c0) ; +} + - ---8<------------------------------------------->8------------------- # console border as aditional led for displaying AltGr keyboard state # - --- linux/drivers/char/vt.c.old Mon May 13 08:36:19 1996 +++ linux/drivers/char/vt.c Sun Mar 9 21:41:39 1997 @@ -87,6 +87,11 @@ extern unsigned long default_font_height; extern unsigned long video_scan_lines; +extern unsigned char con_border_enable; +extern unsigned char con_border_color1; +extern unsigned char con_border_color0; +extern unsigned char con_border_swapleds; + /* * these are the valid i/o ports we're allowed to change. they map all the * video ports @@ -1131,6 +1136,18 @@ if (!suser()) return -EPERM; vt_dont_switch = 0; + return 0; + case KD_SET_BORDER: + if (!perm) + return -EPERM; + i = verify_area(VERIFY_READ, (void *)arg, 4*sizeof(unsigned char)); + if (i) + return i; + con_border_enable = get_user((char *)arg); + con_border_color1 = get_user((char *)arg+1); + con_border_color0 = get_user((char *)arg+2); + con_border_swapleds = get_user((char *)arg+3); + set_leds(); return 0; default: return -ENOIOCTLCMD;
-- Serg.
С нaилyчшими, Garry --- GoldEd 3.00a+ * Origin: -= INT Club =- г.Коpолeв, Россия (2:5020/1188.26)

<< Предыдущая ИНДЕКС Поиск в статьях src Установить закладку Перейти на закладку Следующая >>

 Добавить комментарий
Имя:
E-Mail:
Заголовок:
Текст:




Партнёры:
PostgresPro
Inferno Solutions
Hosting by Hoster.ru
Хостинг:

Закладки на сайте
Проследить за страницей
Created 1996-2024 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру