From: Michael P. <lin...@gr...> - 2006-05-25 20:21:15
|
After some research, many people say putting a 16x pci-e card in a 1x slot should be possible, but I haven't found any success stories. I just tried it with an Asus A8N-SLI motherboard, using a dremel tool to remove the end divider on one of the 1X slots. The machine wouldn't recognize the card at all either as a single or secondary card. Newer boards or bioses may make this possible, but some people have said th= e PCI-E spec does not guarantee operation of a 16x card in a 1x slot. I don't think it will be long before someone sells a 1x video card (nVidia based, not the $130 matrox 1x card) If anyone has success with a 16x card in a 1x slot, we'd love to hear about it. Thanks, Michael Pardee Open Sense Solutions LLC http://open-sense.com 888-323-1742 920-494-3222 On 5/25/06, lin...@li... < lin...@li...> wrote: > > Send Linuxconsole-dev mailing list submissions to > lin...@li... > > To subscribe or unsubscribe via the World Wide Web, visit > https://lists.sourceforge.net/lists/listinfo/linuxconsole-dev > or, via email, send a message with subject or body 'help' to > lin...@li... > > You can reach the person managing the list at > lin...@li... > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Linuxconsole-dev digest..." > > > Today's Topics: > > 1. faketty_hijackled standalone kernel patch available (James van > Zeeland) > 2. Re: faketty_hijackled standalone kernel patch available (Zoltan > Boszormenyi) > > --__--__-- > > Message: 1 > Subject: faketty_hijackled standalone kernel patch available > From: James van Zeeland <ja...@dv...> > To: lin...@li... > Date: Thu, 25 May 2006 19:12:03 +1000 > > > --=3D-UXWZvMM2teRJHCWzEEKf > Content-Type: text/plain > Content-Transfer-Encoding: 7bit > > Hi all. > > I have created a standalone faketty0.05_hijackled patch downloadable > from my homepage; initially against 2.6.16.9, but it should apply > broadly. > > http://members.westnet.com.au/vanzeeland > > I have been getting excellent results with realtime multimedia on a 3Ghz > P4 - I am hoping to get realtime multi-console happenning, but there are > some catches. While it works fine for most applications, indeed, it's > overall latencies are down considerably, PCI video kills the mix; a > multi-console machine will be good for realtime audio only if one uses > the AGP console only, logging out all other consoles and leaving them > alone. > > Any PCI console activity causes audible audio glitches. Bear in mind > that we are recording 32bit audio files from 24bit sources at 96Khz, so > there is a significantly higher load than using 16bit audio. over 4x. > > I am investigating ways to drastic lower the realtime performance impact > from PCI video cards. > Is anyone aware of methods, kernel tweaks or tools that may assist in > altering the PCI performance of the PCI video? > > We effectively don't care about video performance on pci consoles. If it > means they're noticably slower but audio operates in realtime, that's > great. > > Does anyone have any info on how a USB console might load the system? > > I will be posting realtime kernels with faketty included soon, followed > by a more 'vanilla' kernel sometime over the next week or tso. > > Apart from the audio glitches that you may not see or care about outside > of pro-audio usage, the realtime kernels provide excellent desktop > interactivity. > > J > -- > James van Zeeland <ja...@dv...> > > --=3D-UXWZvMM2teRJHCWzEEKf > Content-Disposition: attachment; filename=3D > faketty0.05_hijackled-2.6.16.9.diff > Content-Type: text/x-patch; name=3Dfaketty0.05_hijackled-2.6.16.9.diff; > charset=3DUTF-8 > Content-Transfer-Encoding: 7bit > > diff -ruN 2.6.16.9/drivers/char/keyboard.c 2.6.16-vz1 > /drivers/char/keyboard.c > --- 2.6.16.9/drivers/char/keyboard.c 2006-04-19 16:10:14.000000000+100= 0 > +++ 2.6.16-vz1/drivers/char/keyboard.c 2006-04-19 20:49:54.000000000+100= 0 > @@ -900,6 +900,8 @@ > if (leds !=3D ledstate) { > list_for_each(node, &kbd_handler.h_list) { > struct input_handle * handle =3D to_handle_h(node= ); > + if (handle->dev->grab) > + continue; > 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)); > diff -ruN 2.6.16.9/drivers/input/faketty.c 2.6.16-vz1 > /drivers/input/faketty.c > --- 2.6.16.9/drivers/input/faketty.c 1970-01-01 10:00:00.000000000+100= 0 > +++ 2.6.16-vz1/drivers/input/faketty.c 2006-02-01 23:49:12.000000000+100= 0 > @@ -0,0 +1,922 @@ > +/* > + * Fake TTY char devices, giving access to raw input device events. > + * > + * Copyright (c) 2005 Aivils Stoss > + * > + * This program is free software; you can redistribute it and/or modify > it > + * under the terms of the GNU General Public License version 2 as > published by > + * the Free Software Foundation. > + */ > + > +#define FTTY_MINOR_BASE 96 > +#define FTTY_MINORS 32 > +#define FTTY_BUFFER_SIZE 64 > + > +#include <linux/poll.h> > +#include <linux/slab.h> > +#include <linux/module.h> > +#include <linux/init.h> > +#include <linux/input.h> > +#include <linux/major.h> > +#include <linux/smp_lock.h> > +#include <linux/device.h> > +#include <linux/devfs_fs_kernel.h> > + > +/*#include <linux/kbd_kern.h>*/ > +#include <linux/interrupt.h> > +#include <linux/kd.h> > +#include <linux/vt.h> > + > +#include <linux/version.h> > + > +#include "version.h" > + > +struct kbd_struct { > + > + unsigned char lockstate; > +/* 8 modifiers - the names do not have any meaning at all; > + they can be associated to arbitrarily chosen keys */ > +#define VC_SHIFTLOCK KG_SHIFT /* shift lock mode */ > +#define VC_ALTGRLOCK KG_ALTGR /* altgr lock mode */ > +#define VC_CTRLLOCK KG_CTRL /* control lock mode */ > +#define VC_ALTLOCK KG_ALT /* alt lock mode */ > +#define VC_SHIFTLLOCK KG_SHIFTL /* shiftl lock mode */ > +#define VC_SHIFTRLOCK KG_SHIFTR /* shiftr lock mode */ > +#define VC_CTRLLLOCK KG_CTRLL /* ctrll lock mode */ > +#define VC_CTRLRLOCK KG_CTRLR /* ctrlr lock mode */ > + unsigned char slockstate; /* for `sticky' Shift, Ctrl, etc. > */ > + > + unsigned char ledmode:2; /* one 2-bit value */ > +#define LED_SHOW_FLAGS 0 /* traditional state */ > +#define LED_SHOW_IOCTL 1 /* only change leds upon ioctl */ > +#define LED_SHOW_MEM 2 /* `heartbeat': peek into memory */ > + > + unsigned char ledflagstate:4; /* flags, not lights */ > + unsigned char default_ledflagstate:4; > +#define VC_SCROLLOCK 0 /* scroll-lock mode */ > +#define VC_NUMLOCK 1 /* numeric lock mode */ > +#define VC_CAPSLOCK 2 /* capslock mode */ > +#define VC_KANALOCK 3 /* kanalock mode */ > + > + unsigned char kbdmode:2; /* one 2-bit value */ > +#define VC_XLATE 0 /* translate keycodes using keymap */ > +#define VC_MEDIUMRAW 1 /* medium raw (keycode) mode */ > +#define VC_RAW 2 /* raw (scancode) mode */ > +#define VC_UNICODE 3 /* Unicode mode */ > + > + unsigned char modeflags:5; > +#define VC_APPLIC 0 /* application key mode */ > +#define VC_CKMODE 1 /* cursor key mode */ > +#define VC_REPEAT 2 /* keyboard repeat */ > +#define VC_CRLF 3 /* 0 - enter sends CR, 1 - enter sends > CRLF */ > +#define VC_META 4 /* 0 - meta, 1 - meta=3Dprefix with ESC = */ > +}; > + > +struct evdev { > + int exist; > + int open; > + int minor; > + char name[16]; > + struct input_handle handle; > + wait_queue_head_t wait; > + struct ftty_list *grab; > + struct list_head list; > + struct kbd_struct kbd_table; > + struct kbd_repeat kbrep; > + unsigned char ledstate; > + unsigned char ledioctl; > +}; > + > +#define FTTY_FLIPBUF_SIZE 512 > + > +struct ftty_flip_buffer { > + char *char_buf_ptr; > + unsigned char *flag_buf_ptr; > + int count; > + unsigned char char_buf[FTTY_FLIPBUF_SIZE]; > + char flag_buf[FTTY_FLIPBUF_SIZE]; > + int tail; > +}; > + > +struct ftty_list { > + struct ftty_flip_buffer flip; > + struct fasync_struct *fasync; > + struct evdev *evdev; > + struct list_head node; > + spinlock_t read_lock; > +}; > + > +static struct ledptr { > + unsigned int *addr; > + unsigned int mask; > + unsigned char valid:1; > +} ledptrs[3]; > + > +static struct evdev *evdev_table[FTTY_MINORS]; > +static int sysrq_alt; > +static void ftty_bh(unsigned long dummy); > +static struct input_handler ftty_handler; > + > +DECLARE_TASKLET_DISABLED(ftty_tasklet, ftty_bh, 0); > + > +static inline void ftty_set_leds(void) > +{ > + tasklet_schedule(&ftty_tasklet); > +} > + > +static inline void ftty_insert_flip_char(struct ftty_list *list, > + unsigned char ch, char flag) > +{ > + if (list->flip.count < FTTY_FLIPBUF_SIZE) { > + list->flip.count++; > + *list->flip.flag_buf_ptr++ =3D flag; > + *list->flip.char_buf_ptr++ =3D ch; > + } > +} > + > +static void put_queue(struct ftty_list *list, int ch) > +{ > + ftty_insert_flip_char(list, ch, 0); > +} > + > +#if defined(CONFIG_X86) || defined(CONFIG_IA64) || defined(CONFIG_ALPHA) > ||\ > + defined(CONFIG_MIPS) || defined(CONFIG_PPC) || > defined(CONFIG_SPARC32) ||\ > + defined(CONFIG_SPARC64) || defined(CONFIG_PARISC) || > defined(CONFIG_SUPERH) ||\ > + (defined(CONFIG_ARM) && defined(CONFIG_KEYBOARD_ATKBD) && > !defined(CONFIG_ARCH_RPC)) > + > +#define HW_RAW(dev) (test_bit(EV_MSC, dev->evbit) && test_bit(MSC_RAW, > dev->mscbit) &&\ > + ((dev)->id.bustype =3D=3D BUS_I8042) && ((dev)-> > id.vendor =3D=3D 0x0001) && ((dev)->id.product =3D=3D 0x0001)) > + > +static unsigned short x86_keycodes[256] =3D > + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, > + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, > + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, > + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, > + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, > + 80, 81, 82, 83, 84,118, 86, 87, 88,115,120,119,121,112,123, 92, > + 284,285,309,298,312, 91,327,328,329,331,333,335,336,337,338,339, > + 367,288,302,304,350, 89,334,326,267,126,268,269,125,347,348,349, > + 360,261,262,263,268,376,100,101,321,316,373,286,289,102,351,355, > + 103,104,105,275,287,279,306,106,274,107,294,364,358,363,362,361, > + 291,108,381,281,290,272,292,305,280, 99,112,257,258,359,113,114, > + 264,117,271,374,379,265,266, 93, 94, 95, 85,259,375,260, 90,116, > + 377,109,111,277,278,282,283,295,296,297,299,300,301,293,303,307, > + 308,310,313,314,315,317,318,319,320,357,322,323,324,325,276,330, > + 332,340,365,342,343,344,345,346,356,270,341,368,369,370,371,372 }= ; > + > +static int emulate_raw(struct ftty_list *list, unsigned int keycode, > + unsigned char up_flag) > +{ > + if (keycode > 255 || !x86_keycodes[keycode]) { > + return -1; > + } > + > + switch (keycode) { > + case KEY_PAUSE: > + put_queue(list, 0xe1); > + put_queue(list, 0x1d | up_flag); > + put_queue(list, 0x45 | up_flag); > + return 0; > + case KEY_HANGUEL: > + if (!up_flag) put_queue(list, 0xf1); > + return 0; > + case KEY_HANJA: > + if (!up_flag) put_queue(list, 0xf2); > + return 0; > + } > + > + if (keycode =3D=3D KEY_SYSRQ && sysrq_alt) { > + put_queue(list, 0x54 | up_flag); > + return 0; > + } > + > + if (x86_keycodes[keycode] & 0x100) > + put_queue(list, 0xe0); > + > + put_queue(list, (x86_keycodes[keycode] & 0x7f) | up_flag); > + > + if (keycode =3D=3D KEY_SYSRQ) { > + put_queue(list, 0xe0); > + put_queue(list, 0x37 | up_flag); > + } > + > + return 0; > +} > + > +#else > + > +#define HW_RAW(dev) 0 > + > +#warning "Cannot generate rawmode keyboard for your architecture yet." > + > +static int emulate_raw(struct ftty_list *list, unsigned int keycode, > unsigned char up_flag) > +{ > + if (keycode > 127) > + return -1; > + > + put_queue(list, keycode | up_flag); > + return 0; > +} > +#endif > + > +static void ftty_keycode(struct ftty_list *list, > + unsigned int keycode, int down, > + int hw_raw) > +{ > + struct kbd_struct *kbd; > + > + kbd =3D &list->evdev->kbd_table; > + > + /*Only VC_RAW VC_MEDIUMRAW */ > + if (kbd->kbdmode =3D=3D VC_RAW && !hw_raw) > + if (emulate_raw(list, keycode, !down << 7)) > + if (keycode < BTN_MISC) > + printk(KERN_WARNING "faketty: can't > emulate rawmode for keycode %d\n", keycode); > + > + if (kbd->kbdmode =3D=3D VC_MEDIUMRAW) { > + /* > + * This is extended medium raw mode, with keys above 127 > + * encoded as 0, high 7 bits, low 7 bits, with the 0 > bearing > + * the 'up' flag if needed. 0 is reserved, so this > shouldn't > + * interfere with anything else. The two bytes after 0 > will > + * always have the up flag set not to interfere with olde= r > + * applications. This allows for 16384 different keycodes= , > + * which should be enough. > + */ > + if (keycode < 128) { > + put_queue(list, keycode | (!down << 7)); > + } else { > + put_queue(list, !down << 7); > + put_queue(list, (keycode >> 7) | 0x80); > + put_queue(list, keycode | 0x80); > + } > + } > +} > + > +static void ftty_rawcode(struct ftty_list *list, unsigned char data) > +{ > + if (list->evdev->kbd_table.kbdmode =3D=3D VC_RAW) > + put_queue(list, data); > +} > + > +static void ftty_event(struct input_handle *handle, unsigned int type, > unsigned int code, int value) > +{ > + struct evdev *evdev =3D handle->private; > + struct ftty_list *list; > + > + if (evdev->grab) { > + list =3D evdev->grab; > + > + if (type =3D=3D EV_MSC && code =3D=3D MSC_RAW && > HW_RAW(handle->dev)) > + ftty_rawcode(list, value); > + if (type =3D=3D EV_KEY) > + ftty_keycode(list, code, value, > HW_RAW(handle->dev)); > + kill_fasync(&list->fasync, SIGIO, POLL_IN); > + } > + /* Multiple ftty device read isn't supported */ > + /* Device grab is default */ > + wake_up_interruptible(&evdev->wait); > +} > + > +static int ftty_fasync(int fd, struct file *file, int on) > +{ > + int retval; > + struct ftty_list *list =3D file->private_data; > + retval =3D fasync_helper(fd, file, on, &list->fasync); > + return retval < 0 ? retval : 0; > +} > + > +static int ftty_flush(struct file * file) > +{ > + struct ftty_list *list =3D file->private_data; > + if (!list->evdev->exist) return -ENODEV; > + return input_flush_device(&list->evdev->handle, file); > +} > + > +static void ftty_free(struct evdev *evdev) > +{ > + evdev_table[evdev->minor] =3D NULL; > + kfree(evdev); > +} > + > +static int ftty_release(struct inode * inode, struct file * file) > +{ > + struct ftty_list *list =3D file->private_data; > + > + if (list->evdev->grab =3D=3D list) { > + input_release_device(&list->evdev->handle); > + list->evdev->grab =3D NULL; > + } > + > + ftty_fasync(-1, file, 0); > + list_del(&list->node); > + > + if (!--list->evdev->open) { > + if (list->evdev->exist) > + input_close_device(&list->evdev->handle); > + else > + ftty_free(list->evdev); > + } > + > + kfree(list); > + return 0; > +} > + > +static int ftty_open(struct inode * inode, struct file * file) > +{ > + struct ftty_list *list; > + int i =3D iminor(inode) - FTTY_MINOR_BASE; > + int accept_err; > + > + if (i >=3D FTTY_MINORS || !evdev_table[i] || !evdev_table[i]->exi= st) > + return -ENODEV; > + > + if ((accept_err =3D input_accept_process(&(evdev_table[i]->handle= ), > file))) > + return accept_err; > + > + if (!(list =3D kmalloc(sizeof(struct ftty_list), GFP_KERNEL))) > + return -ENOMEM; > + memset(list, 0, sizeof(struct ftty_list)); > + > + spin_lock_init(&list->read_lock); > + list->evdev =3D evdev_table[i]; > + list_add_tail(&list->node, &evdev_table[i]->list); > + file->private_data =3D list; > + list->flip.char_buf_ptr =3D list->flip.char_buf; > + list->flip.flag_buf_ptr =3D list->flip.flag_buf; > + > + if (!list->evdev->open++) > + if (list->evdev->exist) > + input_open_device(&list->evdev->handle); > + > + list->evdev->kbd_table.kbdmode =3D VC_RAW; > + list->evdev->kbd_table.ledmode =3D LED_SHOW_FLAGS; > + list->evdev->ledstate =3D 0xff; > + > + if (!input_grab_device(&list->evdev->handle)) { > + list->evdev->grab =3D list; > + } > + else > + printk(KERN_INFO "faketty: cannot grab device ftty%d\n", > i); > + > + return 0; > +} > + > +static ssize_t ftty_write(struct file * file, const char __user * buffer= , > size_t count, loff_t *ppos) > +{ > + struct ftty_list *list =3D file->private_data; > + > + if (!list->evdev->exist) return -ENODEV; > + > + return count; > +} > + > +static ssize_t ftty_read(struct file * file, char __user * buffer, size_= t > count, loff_t *ppos) > +{ > + struct ftty_list *list =3D file->private_data; > + int retval; > + unsigned long flags; > + > + if (list->flip.count =3D=3D list->flip.tail && list->evdev->exist= && > (file->f_flags & O_NONBLOCK)) > + return -EAGAIN; > + > + retval =3D wait_event_interruptible(list->evdev->wait, > + list->flip.count !=3D list->flip.tail || > (!list->evdev->exist)); > + > + if (retval) > + return retval; > + > + if (!list->evdev->exist) > + return -ENODEV; > + > + while (list->flip.count !=3D list->flip.tail && retval + 1 <=3D c= ount > && > + list->flip.tail < FTTY_BUFFER_SIZE) { > + if (copy_to_user(buffer + retval, list->flip.char_buf + > list->flip.tail,1)) > + return -EFAULT; > + list->flip.tail =3D list->flip.tail + 1; > + retval++; > + } > + > + if (list->flip.count =3D=3D list->flip.tail) { > + spin_lock_irqsave(&list->read_lock, flags); > + list->flip.char_buf_ptr =3D list->flip.char_buf; > + list->flip.flag_buf_ptr =3D list->flip.flag_buf; > + list->flip.count =3D 0; > + list->flip.tail =3D 0; > + spin_unlock_irqrestore(&list->read_lock, flags); > + } > + > + return retval; > +} > + > +/* No kernel lock - fine */ > +static unsigned int ftty_poll(struct file *file, poll_table *wait) > +{ > + struct ftty_list *list =3D file->private_data; > + poll_wait(file, &list->evdev->wait, wait); > + if (list->flip.count !=3D list->flip.tail) > + return POLLIN | POLLRDNORM; > + return 0; > +} > + > +/* > + * Making beeps and bells. > + */ > +static void kd_nosound(unsigned long ignored) > +{ > + struct list_head * node; > + > + list_for_each(node,&ftty_handler.h_list) { > + struct input_handle *handle =3D to_handle_h(node); > + if (test_bit(EV_SND, handle->dev->evbit)) { > + if (test_bit(SND_TONE, handle->dev->sndbit)) > + input_event(handle->dev, EV_SND, SND_TONE= , > 0); > + if (test_bit(SND_BELL, handle->dev->sndbit)) > + input_event(handle->dev, EV_SND, SND_BELL= , > 0); > + } > + } > +} > + > +static struct timer_list kd_mksound_timer =3D > + TIMER_INITIALIZER(kd_nosound, 0, 0); > + > +void kd_mksound(unsigned int hz, unsigned int ticks) > +{ > + struct list_head * node; > + > + del_timer(&kd_mksound_timer); > + > + if (hz) { > + list_for_each_prev(node,&ftty_handler.h_list) { > + struct input_handle *handle =3D to_handle_h(node)= ; > + if (test_bit(EV_SND, handle->dev->evbit)) { > + if (test_bit(SND_TONE, > handle->dev->sndbit)) { > + input_event(handle->dev, EV_SND, > SND_TONE, hz); > + break; > + } > + if (test_bit(SND_BELL, > handle->dev->sndbit)) { > + input_event(handle->dev, EV_SND, > SND_BELL, 1); > + break; > + } > + } > + } > + if (ticks) > + mod_timer(&kd_mksound_timer, jiffies + ticks); > + } else > + kd_nosound(0); > +} > + > +/* > + * Setting the keyboard rate. > + */ > + > +int kbd_rate(struct input_handle *handle, struct kbd_repeat *rep) > +{ > + struct input_dev *dev =3D handle->dev; > + unsigned int d =3D 0; > + unsigned int p =3D 0; > + > + if (test_bit(EV_REP, dev->evbit)) { > + if (rep->delay > 0) > + input_event(dev, EV_REP, REP_DELAY, rep->delay); > + if (rep->period > 0) > + input_event(dev, EV_REP, REP_PERIOD, rep->period)= ; > + d =3D dev->rep[REP_DELAY]; > + p =3D dev->rep[REP_PERIOD]; > + } > + rep->delay =3D d; > + rep->period =3D p; > + return 0; > +} > + > +/* > + * The leds display either (i) the status of NumLock, CapsLock, > ScrollLock, > + * or (ii) whatever pattern of lights people want to show using KDSETLED= , > + * or (iii) specified bits of specified words in kernel memory. > + */ > +unsigned char ftty_getledstate(struct evdev *evdev) > +{ > + return evdev->ledstate; > +} > + > +void ftty_setledstate(struct evdev *evdev, unsigned int led) > +{ > + if (!(led & ~7)) { > + evdev->ledioctl =3D led; > + evdev->kbd_table.ledmode =3D LED_SHOW_IOCTL; > + } else { > + evdev->kbd_table.ledmode =3D LED_SHOW_FLAGS; > + } > + ftty_set_leds(); > +} > + > +static inline unsigned char ftty_getleds(struct evdev *evdev) > +{ > + struct kbd_struct *kbd =3D &evdev->kbd_table; > + unsigned char leds; > + int i; > + > + if (kbd->ledmode =3D=3D LED_SHOW_IOCTL) > + return evdev->ledioctl; > + > + leds =3D kbd->ledflagstate; > + > + if (kbd->ledmode =3D=3D LED_SHOW_MEM) { > + for (i =3D 0; i < 3; i++) > + if (ledptrs[i].valid) { > + if (*ledptrs[i].addr & ledptrs[i].mask) > + leds |=3D (1 << i); > + else > + leds &=3D ~(1 << i); > + } > + } > + return leds; > +} > + > + > +int ftty_ioctl(struct inode *inode, struct file * file, > + unsigned int cmd, unsigned long arg) > +{ > + struct ftty_list *list =3D file->private_data; > + struct evdev *evdev =3D list->evdev; > + > + struct input_handle *handle =3D &evdev->handle; > + struct kbd_struct * kbd; > + unsigned char ucval; > + void __user *up =3D (void __user *)arg; > + int perm; > + unsigned int ignore =3D cmd >> 8; > + > + if (!evdev->exist) return -ENODEV; > + > + /* > + * To have permissions to do most of the vt ioctls, we either hav= e > + * to be the owner of the tty, or have CAP_SYS_TTY_CONFIG. > + */ > + perm =3D 0; > + if (capable(CAP_SYS_TTY_CONFIG)) > + perm =3D 1; > + > + kbd =3D &list->evdev->kbd_table; > + /*printk("cmd=3D%04x arg=3D%08lx\n", cmd, arg);*/ > + if(ignore =3D=3D 0x54) /* T terminal ioctl's ingnore */ > + return 0; > + if(ignore =3D=3D 0x56) /* V VT ioctl's ingnore */ > + return 0; > + switch (cmd) { > + case KIOCSOUND: > + if (!perm) > + return -EPERM; > + if (arg) > + arg =3D CLOCK_TICK_RATE / arg; > + kd_mksound(arg, 0); > + return 0; > + > + case KDMKTONE: > + if (!perm) > + return -EPERM; > + { > + unsigned int ticks, count; > + > + /* > + * Generate the tone for the appropriate number of ticks. > + * If the time is zero, turn off sound ourselves. > + */ > + ticks =3D HZ * ((arg >> 16) & 0xffff) / 1000; > + count =3D ticks ? (arg & 0xffff) : 0; > + if (count) > + count =3D CLOCK_TICK_RATE / count; > + kd_mksound(count, ticks); > + return 0; > + } > + case KDGKBTYPE: > + /* > + * this is naive. > + */ > + ucval =3D KB_101; > + goto setchar; > + > + /* > + * These cannot be implemented on any machine that > implements > + * ioperm() in user level (such as Alpha PCs) or not at > all. > + * > + * XXX: you should never use these, just call ioperm > directly.. > + */ > +#ifdef CONFIG_X86 > + case KDADDIO: > + case KDDELIO: > + case KDENABIO: > + case KDDISABIO: > + return 0; > +#endif > + > + /* Linux m68k/i386 interface for setting the keyboard delay/repea= t > rate */ > + > + case KDKBDREP: > + { > + struct kbd_repeat * kbrep =3D &list->evdev->kbrep; > + int err; > + > + if (!capable(CAP_SYS_TTY_CONFIG)) > + return -EPERM; > + > + if (copy_from_user(kbrep, up, sizeof(struct kbd_repeat))) > + return -EFAULT; > + err =3D kbd_rate(handle, kbrep); > + if (err) > + return err; > + if (copy_to_user(up, kbrep, sizeof(struct kbd_repeat))) > + return -EFAULT; > + return 0; > + } > + > + case KDSETMODE: > + return 0; > + > + case KDGETMODE: > + ucval =3D KD_GRAPHICS; > + goto setint; > + > + case KDMAPDISP: > + case KDUNMAPDISP: > + return -EINVAL; > + > + case KDSKBMODE: > + if (!perm) > + return -EPERM; > + switch(arg) { > + case K_RAW: > + kbd->kbdmode =3D VC_RAW; > + break; > + case K_MEDIUMRAW: > + kbd->kbdmode =3D VC_MEDIUMRAW; > + break; > + case K_XLATE: > + kbd->kbdmode =3D VC_XLATE; > + break; > + case K_UNICODE: > + kbd->kbdmode =3D VC_UNICODE; > + break; > + default: > + return -EINVAL; > + } > + return 0; > + > + case KDGKBMODE: > + ucval =3D ((kbd->kbdmode =3D=3D VC_RAW) ? K_RAW : > + (kbd->kbdmode =3D=3D VC_MEDIUMRAW) ? > K_MEDIUMRAW : > + (kbd->kbdmode =3D=3D VC_UNICODE) ? K_UNI= CODE > : > + K_XLATE); > + goto setint; > + > + /* this could be folded into KDSKBMODE, but for compatibility > + reasons it is not so easy to fold KDGKBMETA into KDGKBMODE */ > + case KDSKBMETA: > + case KDGKBMETA: > + ucval =3D 0; > + setint: > + return put_user(ucval, (int __user *)arg); > + > + case KDGETKEYCODE: > + case KDSETKEYCODE: > + case KDGKBENT: > + case KDSKBENT: > + case KDGKBSENT: > + case KDSKBSENT: > + case KDGKBDIACR: > + case KDSKBDIACR: > + return 0; > + > + /* the ioctls below read/set the flags usually shown in the leds > */ > + /* don't use them - they will go away without warning */ > + case KDGKBLED: > + ucval =3D kbd->ledflagstate | (kbd->default_ledflagstate = << > 4); > + goto setchar; > + > + case KDSKBLED: > + if (!perm) > + return -EPERM; > + if (arg & ~0x77) > + return -EINVAL; > + kbd->ledflagstate =3D (arg & 7); > + kbd->default_ledflagstate =3D ((arg >> 4) & 7); > + ftty_set_leds(); > + return 0; > + > + /* the ioctls below only set the lights, not the functions */ > + /* for those, see KDGKBLED and KDSKBLED above */ > + case KDGETLED: > + ucval =3D ftty_getledstate(list->evdev); > + setchar: > + return put_user(ucval, (char __user *)arg); > + > + case KDSETLED: > + if (!perm) > + return -EPERM; > + ftty_setledstate(list->evdev, arg); > + return 0; > + > + case KDSIGACCEPT: > + case PIO_FONT: > + case GIO_FONT: > + case PIO_CMAP: > + case GIO_CMAP: > + case PIO_FONTX: > + case GIO_FONTX: > + case PIO_FONTRESET: > + case KDFONTOP: > + case PIO_SCRNMAP: > + case GIO_SCRNMAP: > + case PIO_UNISCRNMAP: > + case GIO_UNISCRNMAP: > + case PIO_UNIMAPCLR: > + case PIO_UNIMAP: > + case GIO_UNIMAP: > + return 0; > + default: > + printk(KERN_INFO "faketty: forgotten ioctl cmd=3D%x > arg=3D%lx\n", cmd, arg); > + return 0; > +/* return -ENOIOCTLCMD; */ > + } > +} > + > + > +static struct file_operations ftty_fops =3D { > + .owner =3D THIS_MODULE, > + .read =3D ftty_read, > + .write =3D ftty_write, > + .poll =3D ftty_poll, > + .open =3D ftty_open, > + .release =3D ftty_release, > + .ioctl =3D ftty_ioctl, > + .fasync =3D ftty_fasync, > + .flush =3D ftty_flush > +}; > + > +static struct input_handle *ftty_connect(struct input_handler *handler, > struct input_dev *dev, struct input_device_id *id) > +{ > + struct evdev *evdev; > + int minor, i; > + > + for (i =3D KEY_RESERVED; i < BTN_MISC; i++) > + if (test_bit(i, dev->keybit)) break; > + > + if ((i =3D=3D BTN_MISC) && !test_bit(EV_SND, dev->evbit)) > + return NULL; > + > + for (minor =3D 0; minor < FTTY_MINORS && evdev_table[minor]; > minor++) > + { > + if (!evdev_table[minor]->exist && > evdev_table[minor]->open) /* reuse */ > + { > + evdev =3D evdev_table[minor]; > + evdev->handle.dev =3D dev; > + evdev->handle.handler =3D handler; > + evdev->handle.private =3D evdev; /* should alread= y > be */ > + evdev->exist =3D 1; > + printk(KERN_INFO "faketty: reusing ftty%d for > vendor/product 0x%x/0x%x\n", minor, dev->id.vendor, dev->id.product); > + input_open_device(&evdev->handle); > + wake_up_interruptible(&evdev->wait); > + return &evdev->handle; > + } > + } > + if (minor =3D=3D FTTY_MINORS) { > + printk(KERN_ERR "faketty: no more free ftty devices\n"); > + return NULL; > + } > + > + if (!(evdev =3D kmalloc(sizeof(struct evdev), GFP_KERNEL))) > + return NULL; > + memset(evdev, 0, sizeof(struct evdev)); > + > + INIT_LIST_HEAD(&evdev->list); > + init_waitqueue_head(&evdev->wait); > + > + evdev->exist =3D 1; > + evdev->minor =3D minor; > + evdev->handle.dev =3D dev; > + evdev->handle.name =3D evdev->name; > + evdev->handle.handler =3D handler; > + evdev->handle.private =3D evdev; > + sprintf(evdev->name, "ftty%d", minor); > + > + evdev_table[minor] =3D evdev; > + > + devfs_mk_cdev(MKDEV(INPUT_MAJOR, FTTY_MINOR_BASE + minor), > + S_IFCHR|S_IRUGO|S_IWUSR, "input/ftty%d", minor); > +#if LINUX_VERSION_CODE >=3D KERNEL_VERSION(2,6,15) > + class_device_create(&input_class, NULL, > + MKDEV(INPUT_MAJOR, FTTY_MINOR_BASE + > minor), > + dev->dev, "ftty%d", minor); > +#else > + #if LINUX_VERSION_CODE >=3D KERNEL_VERSION(2,6,13) > + class_device_create(input_class, > + MKDEV(INPUT_MAJOR, FTTY_MINOR_BASE + > minor), > + dev->dev, "ftty%d", minor); > + #else > + #if LINUX_VERSION_CODE >=3D KERNEL_VERSION(2,6,2) > + class_simple_device_add(input_class, > + MKDEV(INPUT_MAJOR, FTTY_MINOR_BASE + > minor), > + dev->dev, "ftty%d", minor); > + #endif > + #endif > +#endif > + > + return &evdev->handle; > +} > + > +static void ftty_disconnect(struct input_handle *handle) > +{ > + struct evdev *evdev =3D handle->private; > + > +#if LINUX_VERSION_CODE >=3D KERNEL_VERSION(2,6,15) > + class_device_destroy(&input_class, > + MKDEV(INPUT_MAJOR, FTTY_MINOR_BASE + > evdev->minor)); > +#else > + #if LINUX_VERSION_CODE >=3D KERNEL_VERSION(2,6,13) > + class_device_destroy(input_class, > + MKDEV(INPUT_MAJOR, FTTY_MINOR_BASE + > evdev->minor)); > + #else > + #if LINUX_VERSION_CODE >=3D KERNEL_VERSION(2,6,2) > + class_simple_device_remove(MKDEV(INPUT_MAJOR, FTTY_MINOR_BASE + > evdev->minor)); > + #endif > + #endif > +#endif > + devfs_remove("input/ftty%d", evdev->minor); > + evdev->exist =3D 0; > + > + if (evdev->open) { > + input_close_device(handle); > + wake_up_interruptible(&evdev->wait); > + } else > + ftty_free(evdev); > +} > + > +static struct input_device_id ftty_ids[] =3D { > + { > + .flags =3D INPUT_DEVICE_ID_MATCH_EVBIT, > + .evbit =3D { BIT(EV_KEY) }, > + }, > + > + { > + .flags =3D INPUT_DEVICE_ID_MATCH_EVBIT, > + .evbit =3D { BIT(EV_SND) }, > + }, > + > + { }, /* Terminating entry */ > +}; > + > +MODULE_DEVICE_TABLE(input, ftty_ids); > + > +static struct input_handler ftty_handler =3D { > + .event =3D ftty_event, > + .connect =3D ftty_connect, > + .disconnect =3D ftty_disconnect, > + .fops =3D &ftty_fops, > + .minor =3D FTTY_MINOR_BASE, > + .name =3D "ftty", > + .id_table =3D ftty_ids, > +}; > + > +static void ftty_bh(unsigned long dummy) > +{ > + struct list_head * node; > + unsigned char leds; > + > + list_for_each(node,&ftty_handler.h_list) { > + struct input_handle * handle =3D to_handle_h(node); > + struct evdev *evdev =3D handle->private; > + > + leds =3D ftty_getleds(evdev); > + if (leds !=3D evdev->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); > + evdev->ledstate =3D leds; > + } > + } > +} > + > +static int __init ftty_init(void) > +{ > + printk(KERN_INFO "faketty: version %s\n", FTTY_VERSION); > + input_register_handler(&ftty_handler); > + tasklet_enable(&ftty_tasklet); > + tasklet_schedule(&ftty_tasklet); > + > + return 0; > +} > + > +static void __exit ftty_exit(void) > +{ > + tasklet_kill(&ftty_tasklet); > + tasklet_disable(&ftty_tasklet); > + input_unregister_handler(&ftty_handler); > +} > + > +module_init(ftty_init); > +module_exit(ftty_exit); > + > +MODULE_AUTHOR("Aivils Stoss"); > +MODULE_DESCRIPTION("Fake TTY input driver"); > +MODULE_LICENSE("GPL"); > diff -ruN 2.6.16.9/drivers/input/Kconfig 2.6.16-vz1/drivers/input/Kconfig > --- 2.6.16.9/drivers/input/Kconfig 2006-04-19 16:10:14.000000000+100= 0 > +++ 2.6.16-vz1/drivers/input/Kconfig 2006-04-19 20:45:43.000000000+100= 0 > @@ -131,6 +131,16 @@ > To compile this driver as a module, choose M here: the > module will be called evbug. > > +config INPUT_FAKETTY > + tristate "Faketty event interface" > + default m > + help > + Say M here if you want your keyboard device events be accessibl= e > + under char device 13:96+ > + Say M > + To compile this driver as a module, choose M here: the > + module will be called faketty. > + > comment "Input Device Drivers" > > source "drivers/input/keyboard/Kconfig" > diff -ruN 2.6.16.9/drivers/input/Makefile 2.6.16-vz1 > /drivers/input/Makefile > --- 2.6.16.9/drivers/input/Makefile 2006-04-19 16:10:14.000000000+100= 0 > +++ 2.6.16-vz1/drivers/input/Makefile 2006-04-19 20:40:53.000000000+100= 0 > @@ -11,6 +11,7 @@ > obj-$(CONFIG_INPUT_TSDEV) +=3D tsdev.o > obj-$(CONFIG_INPUT_POWER) +=3D power.o > obj-$(CONFIG_INPUT_EVBUG) +=3D evbug.o > +obj-$(CONFIG_INPUT_FAKETTY) +=3D faketty.o > > obj-$(CONFIG_INPUT_KEYBOARD) +=3D keyboard/ > obj-$(CONFIG_INPUT_MOUSE) +=3D mouse/ > diff -ruN 2.6.16.9/drivers/input/version.h 2.6.16-vz1 > /drivers/input/version.h > --- 2.6.16.9/drivers/input/version.h 1970-01-01 10:00:00.000000000+100= 0 > +++ 2.6.16-vz1/drivers/input/version.h 2006-02-01 23:49:12.000000000+100= 0 > @@ -0,0 +1,2 @@ > +/* This file is auto generated*/ > +#define FTTY_VERSION "0.05" > > --=3D-UXWZvMM2teRJHCWzEEKf-- > > > > --__--__-- > > Message: 2 > Date: Thu, 25 May 2006 18:19:35 +0200 > From: Zoltan Boszormenyi <zb...@fr...> > To: James van Zeeland <ja...@dv...> > Cc: lin...@li... > Subject: Re: faketty_hijackled standalone kernel patch available > > Hi, > > James van Zeeland =3DEDrta: > > Hi all. > > > > I have created a standalone faketty0.05_hijackled patch downloadable > > from my homepage; initially against 2.6.16.9, but it should apply > > broadly. > > > > http://members.westnet.com.au/vanzeeland > > > > I have been getting excellent results with realtime multimedia on a 3Gh= =3D > z > > P4 - I am hoping to get realtime multi-console happenning, but there ar= =3D > e > > some catches. While it works fine for most applications, indeed, it's > > overall latencies are down considerably, PCI video kills the mix; a > > multi-console machine will be good for realtime audio only if one uses > > the AGP console only, logging out all other consoles and leaving them > > alone. > > > > Any PCI console activity causes audible audio glitches. Bear in mind > > that we are recording 32bit audio files from 24bit sources at 96Khz, so > > there is a significantly higher load than using 16bit audio. over 4x. > > > > I am investigating ways to drastic lower the realtime performance impac= =3D > t > > from PCI video cards. > > Is anyone aware of methods, kernel tweaks or tools that may assist in > > altering the PCI performance of the PCI video? > > =3D20 > > Using "nice" or "renice" gives you the wanted effect. > It clearly shows on my PCI card if I start "supertux", > it skips very often but I can continue compiling on > the other console... On my system, the PCI VGA > blocks or throttles the PCI IDE in a similar way. > > > We effectively don't care about video performance on pci consoles. If i= =3D > t > > means they're noticably slower but audio operates in realtime, that's > > great. > > > > Does anyone have any info on how a USB console might load the system? > > =3D20 > > USB used to have a CPU hog, you have to test recent kernels. > > > I will be posting realtime kernels with faketty included soon, followe= =3D > d > > by a more 'vanilla' kernel sometime over the next week or tso. > > > > Apart from the audio glitches that you may not see or care about outsid= =3D > e > > of pro-audio usage, the realtime kernels provide excellent desktop > > interactivity. > > > > J > > =3D20 > > For a longer term solution, have you considered the following mainboards? > These two below are consumer-grade boards one can buy in the near future. > > Gigabyte GA-G1975X, 2x PCIe x16 physical slots, 2x PCIe x4 physical > open ended slots, also usable with x16 cards (of these two, one is x1, > the other is x4 but x2 is the x1 slot is used) > > Gigabyte GA-M59SLI-S5 Board, 3x PCIe x16 physical slots, > one of them is x4. > > Workstation mainboard you can buy today: > Supermicro A+ *H8DCE, ***2 PCI-e x16 slots, 2 PCI-e x4 slots (x8 physical= =3D > ) > > The nice thing about PCIe is that any card can work in any slot, > you just have to be able to plug them together. The card and the > slot controller negotiate the common wiring and use the highest > speed both can use. That means that one can cut the end of the slot > so an x16 card can be used in any lower grade slot, as Gigabyte > proved it with GA-G1975X. > > Best regards, > Zolt=3DE1n b=3DF6sz=3DF6rm=3DE9nyi > > > > > --__--__-- > > _______________________________________________ > Linuxconsole-dev mailing list > Lin...@li... > https://lists.sourceforge.net/lists/listinfo/linuxconsole-dev > > > End of Linuxconsole-dev Digest > |