|
From: Aivils S. <ai...@us...> - 2003-09-29 09:11:59
|
Update of /cvsroot/linuxconsole/ruby/ruby-2.6/drivers/char
In directory sc8-pr-cvs1:/tmp/cvs-serv15552/ruby-2.6/drivers/char
Modified Files:
keyboard.c tty_io.c vt.c vt_ioctl.c
Log Message:
reanime /dev/vc/0, keyboard leds
Index: keyboard.c
===================================================================
RCS file: /cvsroot/linuxconsole/ruby/ruby-2.6/drivers/char/keyboard.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- keyboard.c 16 Sep 2003 06:54:42 -0000 1.3
+++ keyboard.c 29 Sep 2003 08:50:56 -0000 1.4
@@ -784,13 +784,13 @@
*/
unsigned char getledstate(struct vc_data *vc)
{
- return vc->vc_ledstate;
+ return vc->display_fg->vt_ledstate;
}
void setledstate(struct vc_data *vc, unsigned int led)
{
if (!(led & ~7)) {
- vc->vc_ledioctl = led;
+ vc->display_fg->vt_ledioctl = led;
vc->kbd_table.ledmode = LED_SHOW_IOCTL;
} else
vc->kbd_table.ledmode = LED_SHOW_FLAGS;
@@ -815,7 +815,7 @@
int i;
if (vc->kbd_table.ledmode == LED_SHOW_IOCTL)
- return vc->vc_ledioctl;
+ return vc->display_fg->vt_ledioctl;
leds = vc->kbd_table.ledflagstate;
@@ -857,12 +857,12 @@
if (vt) {
leds = getleds(vt->fg_console);
- if (leds != vt->fg_console->vc_ledstate) {
+ if (leds != vt->vt_ledstate) {
input_event(handle->dev, EV_LED, LED_SCROLLL, !!(leds & 0x01));
input_event(handle->dev, EV_LED, LED_NUML, !!(leds & 0x02));
input_event(handle->dev, EV_LED, LED_CAPSL, !!(leds & 0x04));
input_sync(handle->dev);
- vt->fg_console->vc_ledstate = leds;
+ vt->vt_ledstate = leds;
}
}
}
@@ -882,12 +882,12 @@
tasklet_disable(&keyboard_tasklet);
leds = getleds(vt->fg_console);
- if (leds != vt->fg_console->vc_ledstate) {
+ if (leds != vt->vt_ledstate) {
input_event(handle->dev, EV_LED, LED_SCROLLL, !!(leds & 0x01));
input_event(handle->dev, EV_LED, LED_NUML, !!(leds & 0x02));
input_event(handle->dev, EV_LED, LED_CAPSL, !!(leds & 0x04));
input_sync(handle->dev);
- vt->fg_console->vc_ledstate = leds;
+ vt->vt_ledstate = leds;
}
tasklet_enable(&keyboard_tasklet);
}
@@ -1155,9 +1155,8 @@
vt->keyboard = handle;
handle->private = vt;
printk(KERN_INFO "keyboard.c: %s vc:%d-%d\n",
- dev->name,
- vt->first_vc,
- vt->first_vc + vt->vc_count - 1);
+ dev->name, vt->first_vc + 1,
+ vt->first_vc + vt->vc_count);
if(test_bit(EV_SND, dev->evbit)) {
vt->beeper = handle;
vt_map_input(vt);
Index: tty_io.c
===================================================================
RCS file: /cvsroot/linuxconsole/ruby/ruby-2.6/drivers/char/tty_io.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- tty_io.c 11 Aug 2003 16:26:46 -0000 1.1
+++ tty_io.c 29 Sep 2003 08:50:56 -0000 1.2
@@ -100,6 +100,7 @@
#include <linux/kmod.h>
+#define IS_CONSOLE_DEV(dev) (kdev_val(dev) == __mkdev(TTY_MAJOR,0))
#define IS_TTY_DEV(dev) (kdev_val(dev) == __mkdev(TTYAUX_MAJOR,0))
#define IS_SYSCONS_DEV(dev) (kdev_val(dev) == __mkdev(TTYAUX_MAJOR,1))
#define IS_PTMX_DEV(dev) (kdev_val(dev) == __mkdev(TTYAUX_MAJOR,2))
@@ -1316,7 +1317,21 @@
/* noctty = 1; */
goto got_driver;
}
-
+#ifdef CONFIG_VT
+ if (IS_CONSOLE_DEV(device)) {
+ struct vc_data *vc;
+ extern struct tty_driver *console_driver;
+ if (!current->tty)
+ return -ENXIO;
+ driver = console_driver;
+ vc = (struct vc_data *)current->tty->driver_data;
+ if (!vc)
+ return -ENXIO;
+ index = vc->display_fg->fg_console->vc_num;
+ noctty = 1;
+ goto got_driver;
+ }
+#endif
if (IS_SYSCONS_DEV(device)) {
struct console *c = console_drivers;
for (c = console_drivers; c; c = c->next) {
@@ -2412,6 +2427,9 @@
#ifdef CONFIG_UNIX98_PTYS
static struct cdev ptmx_cdev;
#endif
+#ifdef CONFIG_VT
+static struct cdev vc0_cdev;
+#endif
/*
* Ok, now we can initialize the rest of the tty devices and can count
@@ -2449,6 +2467,14 @@
#endif
#ifdef CONFIG_VT
+ strcpy(vc0_cdev.kobj.name, "dev.vc0");
+ cdev_init(&vc0_cdev, &tty_fops);
+ if (cdev_add(&vc0_cdev, MKDEV(TTY_MAJOR, 0), 1) ||
+ register_chrdev_region(MKDEV(TTY_MAJOR, 0), 1, "/dev/vc/0") < 0)
+ panic("Couldn't register /dev/tty0 driver\n");
+ devfs_mk_cdev(MKDEV(TTY_MAJOR, 0), S_IFCHR|S_IRUSR|S_IWUSR, "vc/0");
+ tty_add_class_device ("tty0", MKDEV(TTY_MAJOR, 0), NULL);
+
vty_init();
#endif
#ifdef CONFIG_ESPSERIAL /* init ESP before rs, so rs doesn't see the port */
Index: vt.c
===================================================================
RCS file: /cvsroot/linuxconsole/ruby/ruby-2.6/drivers/char/vt.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- vt.c 16 Sep 2003 06:54:42 -0000 1.3
+++ vt.c 29 Sep 2003 08:50:56 -0000 1.4
@@ -979,7 +979,7 @@
/* although the numbers above are not valid since long ago, the
point is still up-to-date and the comment still has its value
even if only as a historical artifact. --mj, July 1998 */
- if (vt->vt_kmalloced || !((vt->first_vc + 1)== currcons))
+ if (vt->vt_kmalloced || !((vt->first_vc)== currcons))
vc = (struct vc_data *) kmalloc(sizeof(struct vc_data), GFP_KERNEL);
else
vc = (struct vc_data *) alloc_bootmem(sizeof(struct vc_data));
@@ -992,7 +992,7 @@
cons_num = currcons;
vc->display_fg = vt;
visual_init(vc, 1);
- if (vt->vt_kmalloced || !((vt->first_vc + 1) == currcons)) {
+ if (vt->vt_kmalloced || !((vt->first_vc) == currcons)) {
screenbuf = (unsigned short *) kmalloc(screenbuf_size, GFP_KERNEL);
if (!screenbuf) {
kfree(vc);
@@ -1016,7 +1016,7 @@
}
}
vt->vc_cons[currcons - vt->first_vc] = vc;
- if ((vt->first_vc + 1) == currcons)
+ if ((vt->first_vc) == currcons)
vt->want_vc = vt->fg_console = vt->last_console = vc;
vc_init(vc, 1);
return vc;
@@ -1732,7 +1732,7 @@
{
const char *display_desc;
- if (current_vc + vc_count > MAX_NR_CONSOLES + 1)
+ if (current_vc + vc_count - 1 > MAX_NR_CONSOLES)
return NULL;
display_desc = vt->vt_sw->con_startup(vt, init);
@@ -1757,7 +1757,7 @@
mod_timer(&vt->timer, jiffies + vt->blank_interval);
if (vt->pm_con)
vt->pm_con->data = vt;
- vt->vc_cons[1] = vc_allocate(current_vc+1);
+ vt->vc_cons[0] = vc_allocate(current_vc);
vt->keyboard = NULL;
INIT_WORK(&vt->vt_work, vt_callback, vt);
@@ -1830,9 +1830,9 @@
console_driver->owner = THIS_MODULE;
console_driver->devfs_name = "vc/";
console_driver->name = "tty";
- console_driver->name_base = 0;
+ console_driver->name_base = 1;
console_driver->major = TTY_MAJOR;
- console_driver->minor_start = 0;
+ console_driver->minor_start = 1;
console_driver->type = TTY_DRIVER_TYPE_CONSOLE;
console_driver->init_termios = tty_std_termios;
console_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_RESET_TERMIOS;
Index: vt_ioctl.c
===================================================================
RCS file: /cvsroot/linuxconsole/ruby/ruby-2.6/drivers/char/vt_ioctl.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- vt_ioctl.c 12 Sep 2003 08:33:21 -0000 1.2
+++ vt_ioctl.c 29 Sep 2003 08:50:56 -0000 1.3
@@ -1010,9 +1010,9 @@
unsigned short mask, state = 0;
struct vc_data *tmp;
- if (put_user(vc->display_fg->fg_console->vc_num, &vtstat->v_active))
+ if (put_user(vc->display_fg->fg_console->vc_num + 1, &vtstat->v_active))
return -EFAULT;
- for (i = 0, mask = 0; i < MAX_NR_CONSOLES && mask; ++i, mask <<= 1) {
+ for (i = 0, mask = 0; i < vc->display_fg->vc_count && mask; ++i, mask <<= 1) {
tmp = find_vc(i + vc->display_fg->first_vc);
if (tmp && VT_IS_IN_USE(tmp))
state |= mask;
@@ -1027,7 +1027,7 @@
{
int j = vc->display_fg->first_vc;
- for ((j) ? (i = 0) : (i = j = 1); i < vc->display_fg->vc_count; ++i, j++) {
+ for (i = 0; i < vc->display_fg->vc_count; ++i, j++) {
struct vc_data *tmp = find_vc(j);
if (!tmp || (tmp && !VT_IS_IN_USE(tmp)))
@@ -1047,9 +1047,10 @@
if (!perm)
return -EPERM;
- if (arg > MAX_NR_CONSOLES)
+ if (arg == 0 || arg > MAX_NR_CONSOLES)
return -ENXIO;
+ arg--;
tmp = find_vc(arg);
if (!tmp) {
tmp = vc_allocate(arg);
@@ -1067,7 +1068,7 @@
*/
case VT_WAITACTIVE:
{
- struct vc_data *tmp = find_vc(arg);
+ struct vc_data *tmp = find_vc(arg-1);
if (!perm)
return -EPERM;
@@ -1097,7 +1098,7 @@
* Switching-from response
*/
if (vc->vt_newvt >= 0) {
- if (arg == vc->display_fg->fg_console->vc_num)
+ if (arg == 0)
/*
* Switch disallowed, so forget we were trying
* to do it.
@@ -1147,9 +1148,9 @@
if (arg > MAX_NR_CONSOLES)
return -ENXIO;
- if (arg == vt->fg_console->vc_num) {
+ if (arg == 0) {
/* disallocate all unused consoles, but leave visible VC */
- for (i = 0; i < MAX_NR_CONSOLES; i++) {
+ for (i = 1; i < vt->vc_count; i++) {
tmp = find_vc(i + vt->first_vc);
if (tmp && !VT_BUSY(tmp))
@@ -1157,7 +1158,7 @@
}
} else {
/* disallocate a single console, if possible */
- tmp = find_vc(arg);
+ tmp = find_vc(arg-1);
if (!tmp || VT_BUSY(tmp))
return -EBUSY;
vc_disallocate(tmp);
|