Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Revert "Removed unused files"

This reverts commit 7b70c3b.
  • Loading branch information...
commit 8530fdb108f05556d323f331c8d3e5dbd5e20b2e 1 parent 8049cb9
@Lekensteyn Lekensteyn authored
View
48 asus1215n.sh
@@ -0,0 +1,48 @@
+#!/bin/sh
+# Power control for Asus 1215N Optimus
+# by Pete Eberlein
+
+if ! lsmod | grep -q acpi_call; then
+ echo "Error: acpi_call module not loaded"
+ exit
+fi
+
+acpi_call () {
+ echo "$*" > /proc/acpi/call
+ cat /proc/acpi/call
+}
+
+
+case "$1" in
+off)
+ echo _DSM $(acpi_call "\_SB.PCI0.P0P4.GFX0._DSM" \
+ "{0xF8,0xD8,0x86,0xA4,0xDA,0x0B,0x1B,0x47," \
+ "0xA7,0x2B,0x60,0x42,0xA6,0xB5,0xBE,0xE0}" \
+ "0x100 0x1A {0x1,0x0,0x0,0x3}")
+ # ok to turn off: Buffer {0x59 0x0 0x0 0x11}
+ # is already off: Buffer {0x41 0x0 0x0 0x11}
+ echo _PS3 $(acpi_call "\_SB.PCI0.P0P4.GFX0._PS3")
+;;
+on)
+ echo _PS0 $(acpi_call "\_SB.PCI0.P0P4.GFX0._PS0")
+;;
+*)
+ echo "Usage: $0 [on|off]"
+esac
+
+
+echo P3MO $(acpi_call "\_SB.PCI0.P0P4.GFX0.P3MO")
+echo DGPS $(acpi_call "\_SB.PCI0.P0P4.GFX0.DGPS")
+PSC=$(acpi_call "\_SB.PCI0.P0P4.GFX0._PSC")
+echo _PSC ${PSC}
+case "$PSC" in
+0x0)
+ PSC="on"
+;;
+0x3)
+ PSC="off"
+;;
+esac
+echo "Asus 1215N Optimus appears to be ${PSC}"
+
+
View
27 m11xr2.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+# Based on m11xr2hack by George Shearer
+
+if ! lsmod | grep -q acpi_call; then
+ echo "Error: acpi_call module not loaded"
+ exit
+fi
+
+acpi_call () {
+ echo "$*" > /proc/acpi/call
+ cat /proc/acpi/call
+}
+
+
+case "$1" in
+off)
+ echo NVOP $(acpi_call "\_SB.PCI0.P0P2.PEGP.NVOP 0 0x100 0x1A {255,255,255,255}")
+ echo _PS3 $(acpi_call "\_SB.PCI0.P0P2.PEGP._PS3")
+;;
+on)
+ echo _PS0 $(acpi_call "\_SB.PCI0.P0P2.PEGP._PS0")
+;;
+*)
+ echo "Usage: $0 [on|off]"
+;;
+esac
+
View
67 query_dsdt.pl
@@ -0,0 +1,67 @@
+#!/usr/bin/perl
+use strict;
+use Getopt::Long;
+use Data::Dumper;
+
+my ($dir,$debug,$mytokens);
+$dir = '.';
+GetOptions(
+ 'd|dir:s' => \$dir,
+ 'debug:s' => \$debug,
+ 't|tokens:s' => \$mytokens,
+ );
+
+my $models;
+
+my @tokens = (
+ 'MXMX','MXDS','_DSM',
+ '0xA6, 0xFA, 0xDD, 0x3D, 0x1B, 0x36, 0xB4, 0x4E',
+ '0xA4, 0x24, 0x8D, 0x10, 0x08, 0x9D, 0x16, 0x53');
+
+if (defined $mytokens) {
+ @tokens = ();
+ foreach my $mytoken (split(":",$mytokens)) {
+ push @tokens, $mytoken;
+ }
+}
+
+opendir DIR,$dir or die $!;
+my $file;
+my $count = 0;
+while (( defined($file = readdir(DIR)) )) {
+ if ($file =~ /\.dsl$/) {
+ analyse_file($dir,$file);
+ }
+ last if ($count++ > $debug && defined($debug));
+}
+
+foreach my $file (sort keys %$models) {
+ my $num = scalar keys %{$models->{$file}}; $num = sprintf("%02d",$num);
+ print "$num $file \{";
+ foreach my $token (sort keys %{$models->{$file}}) {
+ my $value = $models->{$file}{$token};
+ print "\t$token => $value ";
+ }
+ print "\}\n";
+}
+$DB::single=1;1;
+print STDERR Dumper($models) if ($debug);
+
+########################################
+
+sub analyse_file {
+ my $dir = shift;
+ my $file = shift;
+ my $param = shift;
+
+ open FILE, "$dir/$file" or die $!;
+ while (<FILE>) {
+ foreach my $token (@tokens) {
+ my $regexp = qr/${token}/;
+ if ($_ =~ /$regexp/g) {
+ $models->{$file}{$token}++;
+ }
+ }
+ }
+ close FILE;
+}
View
49 test_off.sh
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+if lsmod | grep -q acpi_call; then
+methods="
+\_SB.PCI0.P0P1.VGA._OFF
+\_SB.PCI0.P0P2.VGA._OFF
+\_SB_.PCI0.OVGA.ATPX
+\_SB_.PCI0.OVGA.XTPX
+\_SB.PCI0.P0P3.PEGP._OFF
+\_SB.PCI0.P0P2.PEGP._OFF
+\_SB.PCI0.P0P1.PEGP._OFF
+\_SB.PCI0.MXR0.MXM0._OFF
+\_SB.PCI0.PEG1.GFX0._OFF
+\_SB.PCI0.PEG0.GFX0.DOFF
+\_SB.PCI0.PEG1.GFX0.DOFF
+\_SB.PCI0.PEG0.PEGP._OFF
+\_SB.PCI0.XVR0.Z01I.DGOF
+\_SB.PCI0.PEGR.GFX0._OFF
+\_SB.PCI0.PEG.VID._OFF
+\_SB.PCI0.PEG0.VID._OFF
+\_SB.PCI0.P0P2.DGPU._OFF
+\_SB.PCI0.P0P4.DGPU.DOFF
+\_SB.PCI0.IXVE.IGPU.DGOF
+\_SB.PCI0.RP00.VGA._PS3
+\_SB.PCI0.RP00.VGA.P3MO
+\_SB.PCI0.GFX0.DSM._T_0
+\_SB.PCI0.LPC.EC.PUBS._OFF
+\_SB.PCI0.P0P2.NVID._OFF
+\_SB.PCI0.P0P2.VGA.PX02
+"
+
+ for m in $methods; do
+echo -n "Trying $m: "
+ echo $m > /proc/acpi/call
+ result=$(cat /proc/acpi/call)
+ case "$result" in
+ Error*)
+ echo "failed"
+ ;;
+ *)
+ echo "works!"
+ break
+ ;;
+ esac
+done
+else
+echo 'The acpi_call module is not loaded'
+ exit 1
+fi
View
285 windump_hack/windump.c
@@ -0,0 +1,285 @@
+#include <sys/ipc.h>
+#include <sys/shm.h>
+#include <X11/Xos.h>
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/cursorfont.h>
+#include <X11/extensions/XShm.h>
+#include <X11/extensions/XTest.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+
+int format = ZPixmap;
+
+XImage *
+CaptRoot(Display * dpy, int screen)
+{
+ unsigned long swaptest = 1;
+ XColor *colors;
+ unsigned buffer_size;
+ int win_name_size;
+ int header_size;
+ int ncolors, i;
+ char *win_name;
+ Bool got_win_name;
+ XWindowAttributes win_info;
+ XImage *image;
+ int absx, absy, x, y;
+ unsigned width, height;
+ int dwidth, dheight;
+ int bw;
+ Window dummywin;
+
+#if 0
+ int transparentOverlays , multiVis;
+ int numVisuals;
+ XVisualInfo *pVisuals;
+ int numOverlayVisuals;
+ OverlayInfo *pOverlayVisuals;
+ int numImageVisuals;
+ XVisualInfo **pImageVisuals;
+ list_ptr vis_regions; /* list of regions to read from */
+ list_ptr vis_image_regions ;
+ Visual vis_h,*vis ;
+#endif
+ int allImage = 0 ;
+
+ Window window=RootWindow (dpy, screen);
+
+ if (!XGetWindowAttributes(dpy, window, &win_info))
+ { fprintf(stderr,"Can't get target window attributes."); exit(1); }
+
+ absx=0; absy=0;
+ win_info.x = 0;
+ win_info.y = 0;
+ width = win_info.width;
+ height = win_info.height;
+ bw = 0;
+
+ dwidth = DisplayWidth (dpy, screen);
+ dheight = DisplayHeight (dpy, screen);
+
+ XFetchName(dpy, window, &win_name);
+ if (!win_name || !win_name[0]) {
+ win_name = "xwdump";
+ got_win_name = False;
+ } else {
+ got_win_name = True;
+ }
+
+ /* sizeof(char) is included for the null string terminator. */
+ win_name_size = strlen(win_name) + sizeof(char);
+
+ /*
+ * Snarf the pixmap with XGetImage.
+ */
+
+ x = absx - win_info.x;
+ y = absy - win_info.y;
+#if 0
+ multiVis = GetMultiVisualRegions(dpy,RootWindow(dpy, screen),absx,absy,
+ width,height,&transparentOverlays,&numVisuals,&pVisuals,
+ &numOverlayVisuals,&pOverlayVisuals,&numImageVisuals,
+ &pImageVisuals,&vis_regions,&vis_image_regions,&allImage) ;
+ if (on_root || multiVis)
+ {
+ if (!multiVis)
+ image = XGetImage (dpy, RootWindow(dpy, screen), absx, absy,
+ width, height, AllPlanes, format);
+ else
+ image = ReadAreaToImage(dpy, RootWindow(dpy, screen), absx, absy,
+ width, height,
+ numVisuals,pVisuals,numOverlayVisuals,pOverlayVisuals,
+ numImageVisuals, pImageVisuals,vis_regions,
+ vis_image_regions,format,allImage);
+ }
+ else
+#endif
+ image = XGetImage (dpy, window, x, y, width, height,
+ AllPlanes, format);
+ if (!image) {
+ fprintf (stderr, "unable to get image at %dx%d+%d+%d\n",
+ width, height, x, y);
+ exit (1);
+ }
+
+ //if (add_pixel_value != 0) XAddPixel (image, add_pixel_value);
+
+ return image;
+}
+
+Window CreateWindow(Display * dpy, int screen, int width, int height)
+{
+ Window win = 0;
+ win = XCreateWindow(dpy, RootWindow(dpy, screen),
+ 0, 0, width, height,
+ 0,
+ 24,
+ InputOutput,
+ DefaultVisual(dpy, screen),
+ //CWBorderPixel|CWBackPixel|CWColormap|CWEventMask|CWBitGravity,
+ 0,
+ 0);
+
+ XSelectInput(dpy, win, StructureNotifyMask|ButtonPressMask|ButtonReleaseMask);
+
+ XMapWindow(dpy, win);
+ return win;
+}
+
+void DrawImage(Display * dpy, Window win, XImage * image)
+{
+ static GC gc;
+ if(win!=0)
+ {
+ if(gc==0)
+ {
+ XGCValues gc_val;
+ gc = XCreateGC (dpy, win, GCForeground|GCBackground, &gc_val);
+ }
+ /*for(i=0;i<100;i++)
+ {
+ image->data*/
+ XPutImage (dpy, win, gc, image, 0, 0, 0, 0, 1024, 768);
+ }
+}
+
+void createShmImage(int w, int h, XShmSegmentInfo * sinfo, XShmSegmentInfo * tinfo, Display * sdpy, Display * tdpy, int sscr, int tscr, XImage ** simage, XImage ** timage)
+{
+ sinfo->shmid=tinfo->shmid=shmget(IPC_PRIVATE,w*h*sizeof(unsigned),IPC_CREAT|0666 );
+ sinfo->shmaddr=tinfo->shmaddr=(char*)shmat(sinfo->shmid,0,0);
+ sinfo->readOnly=tinfo->readOnly=False;
+ printf("%d %d\n",DefaultDepth(sdpy,sscr),DefaultDepth(tdpy,tscr));
+ *simage = XShmCreateImage(
+ sdpy, DefaultVisual(sdpy,sscr), DefaultDepth(sdpy,sscr),
+ ZPixmap/*format*/,
+ (char *)sinfo->shmaddr, sinfo,
+ w,h /*width,height*/
+ );
+ *timage = XShmCreateImage(
+ tdpy, DefaultVisual(tdpy,tscr), DefaultDepth(tdpy,tscr),
+ ZPixmap/*format*/,
+ (char *)tinfo->shmaddr, tinfo,
+ w,h /*width,height*/
+ );
+ XShmAttach(sdpy, sinfo);
+ XShmAttach(tdpy, tinfo);
+}
+
+void drawMouse(XImage * img, int xm, int ym)
+{
+ int x,y,x1,y1,x2,y2,w,h;
+
+ unsigned * data = (unsigned *)(img->data);
+
+ w=img->width;
+ h=img->height;
+
+ x=xm; if(x<0) x=0; if(x>w) x=w-1;
+ y=ym; if(y<0) y=0; if(y>h) y=h-1;
+ x1=xm-5; if(x1<0) x1=0; if(x1>w) x1=w;
+ x2=xm+6; if(x2<0) x2=0; if(x2>w) x2=w;
+ for(x=x1;x<x2;x++) data[y*w+x] = 0xFFFFFF;
+ //data[y*w+x] = 0xFFFFFF;
+
+ x=xm; if(x<0) x=0; if(x>w) x=w-1;
+ y=ym; if(y<0) y=0; if(y>h) y=h-1;
+ y1=ym-5; if(y1<0) y1=0; if(y1>h) y1=h;
+ y2=ym+6; if(y2<0) y2=0; if(y2>h) y2=h;
+ for(y=y1;y<y2;y++) data[y*w+x] = 0xFFFFFF;
+
+}
+
+main(int argc, char * argv [])
+{
+ Display * sdpy = XOpenDisplay(argv[1]);
+ Display * tdpy = XOpenDisplay(argv[2]);
+ int sscr = XDefaultScreen(sdpy);
+ int tscr = XDefaultScreen(tdpy);
+ GC tgc = DefaultGC(tdpy,tscr);
+ Window swin=RootWindow (sdpy,sscr);
+ int width, height, dummy;
+ XGetGeometry(sdpy, swin, (Window *)&dummy, &dummy, &dummy, &width, &height, &dummy, &dummy);
+ Window twin=CreateWindow(tdpy,tscr,width,height);
+ XSelectInput(sdpy, swin, PointerMotionMask);
+ XImage * image;
+ XImage * simage;
+ XImage * timage;
+ int use_shm=1;
+ XShmSegmentInfo xshm_sinfo;
+ XShmSegmentInfo xshm_tinfo;
+ if(use_shm) createShmImage(width,height,&xshm_sinfo,&xshm_tinfo,sdpy,tdpy,sscr,tscr,&simage,&timage);
+ int frame=0;
+ for(;;) {
+ XEvent e;
+ XNextEvent(tdpy, &e);
+ if (e.type == MapNotify)
+ break;
+ }
+
+ int emulate_events=0;
+
+ int xmouse, ymouse;
+ while(1)
+ {
+ {
+ XEvent e;
+ //long mask=ButtonPressMask|ButtonReleaseMask|MotionNotifyMask;
+ //while(XCheckWindowEvent(tdpy, twin, mask, &e)!=False)
+ while(XCheckTypedWindowEvent(tdpy, twin, ButtonPress, &e)!=False ||
+ XCheckTypedWindowEvent(tdpy, twin, ButtonRelease, &e)!=False)
+ {
+ printf("button event\n");
+ if(emulate_events)
+ {
+ e.xbutton.display=sdpy;
+ e.xbutton.window=swin;
+ e.xbutton.root=swin;
+ e.xbutton.window=swin;
+ e.xbutton.x_root=e.xbutton.x;
+ e.xbutton.y_root=e.xbutton.y;
+ //XSendEvent( sdpy, swin, True, mask, &e );
+ XPutBackEvent( sdpy, &e );
+ //XTestFakeMotionEvent(sdpy,sscr,e.xbutton.x,e.xbutton.y,0);
+ XTestFakeButtonEvent(sdpy,e.xbutton.button,e.xbutton.type==ButtonPress,0);
+ }
+ }
+ while(XCheckTypedWindowEvent(sdpy, swin, MotionNotify, &e)!=False)
+ {
+ //printf("motion event\n");
+ xmouse=e.xbutton.x_root;
+ ymouse=e.xbutton.y_root;
+ }
+ }
+ //printf("frame %d\n", frame++);
+ usleep(60000);
+ if(!use_shm)
+ {
+ image=CaptRoot(sdpy,sscr);
+ DrawImage(tdpy,twin,image);
+ XDestroyImage(image);
+ }
+ else
+ {
+// XShmAttach(sdpy, &xshm_sinfo);
+ XShmGetImage (sdpy, swin, simage, 0, 0, AllPlanes);
+// XShmAttach(sdpy, &xshm_tinfo);
+ //printf("simage: w:%d h:%d d:%d\n",simage->width, simage->height, simage->depth);
+ //printf("timage: w:%d h:%d d:%d\n",timage->width, timage->height, timage->depth);
+ if(!emulate_events)
+ {
+ Window rwin,cwin;
+ int xmouse,ymouse,x,y,mask;
+ XQueryPointer(sdpy,swin,&rwin,&cwin,&xmouse,&ymouse,&x,&y,&mask);
+ drawMouse(timage, xmouse, ymouse);
+ }
+
+ XShmPutImage (tdpy, twin, tgc, timage, 0, 0, 0, 0, timage->width, timage->height, False);
+ //XPutImage (tdpy, twin, tgc, timage, 0, 0, 0, 0, timage->width, timage->height);
+ }
+ //XFlush(sdpy);
+ XFlush(tdpy);
+// getchar();
+ }
+}
View
83 windump_hack/xorg.conf
@@ -0,0 +1,83 @@
+# nvidia-xconfig: X configuration file generated by nvidia-xconfig
+# nvidia-xconfig: version 270.41.06 (buildmeister@swio-display-x86-rhel47-08.nvidia.com) Mon Apr 18 15:14:00 PDT 2011
+
+Section "ServerLayout"
+ Identifier "Layout0"
+ Screen "Screen0"
+ Screen "Screen1" RightOf "Screen0"
+ InputDevice "Keyboard0" "SendCoreEvents"
+ #InputDevice "Keyboard0" "CoreKeyboard"
+ InputDevice "Mouse0" "SendCoreEvents"
+ #InputDevice "Mouse0" "CorePointer"
+EndSection
+
+#Section "ServerFlags"
+# Option "AllowEmptyInput" "no"
+#EndSection
+
+Section "Files"
+EndSection
+
+Section "InputDevice"
+ # generated from default
+ Identifier "Mouse0"
+ Driver "mouse"
+ Option "Protocol" "auto"
+ Option "Device" "/dev/psaux"
+ Option "Emulate3Buttons" "no"
+ Option "ZAxisMapping" "4 5"
+EndSection
+
+Section "InputDevice"
+ # generated from default
+ Identifier "Keyboard0"
+ Driver "kbd"
+EndSection
+
+Section "Monitor"
+ Identifier "Monitor0"
+ VendorName "Unknown"
+ ModelName "Unknown"
+ HorizSync 28.0 - 73.0
+ VertRefresh 43.0 - 72.0
+ Option "DPMS"
+EndSection
+
+Section "Device"
+ Identifier "Device1"
+ Driver "nvidia"
+ VendorName "NVIDIA Corporation"
+ BusID "PCI:1:0:0"
+ Option "IgnoreEDID"
+ #Screen 0
+EndSection
+
+Section "Device"
+ Identifier "Device0"
+ Driver "intel"
+ VendorName "onboard"
+ BusID "PCI:0:2:0"
+ #Screen 1
+EndSection
+
+Section "Screen"
+ Identifier "Screen1"
+ Device "Device0"
+ Monitor "Monitor0"
+ DefaultDepth 24
+ SubSection "Display"
+ Depth 24
+ EndSubSection
+EndSection
+
+Section "Screen"
+ Identifier "Screen0"
+ Device "Device1"
+ Monitor "Monitor0"
+ DefaultDepth 24
+ SubSection "Display"
+ Depth 24
+ Modes "1024x768"
+ EndSubSection
+EndSection
+
Please sign in to comment.
Something went wrong with that request. Please try again.