diff options
author | jakub <jakub> | 1999-10-01 09:53:01 +0000 |
---|---|---|
committer | jakub <jakub> | 1999-10-01 09:53:01 +0000 |
commit | 67bd566b8803e9c1797fe8bfcc06cb55100b8fe0 (patch) | |
tree | 0fbac25b1d6b85bcc4cbd92b84897851c6edd2d1 | |
parent | aab715f80948a6a6657707ae2c456587a39e7be7 (diff) | |
download | anaconda-67bd566b8803e9c1797fe8bfcc06cb55100b8fe0.tar.gz anaconda-67bd566b8803e9c1797fe8bfcc06cb55100b8fe0.tar.xz anaconda-67bd566b8803e9c1797fe8bfcc06cb55100b8fe0.zip |
Add fbconProbe which returns video RAM size in KB for specified
/dev/fbN device.
-rw-r--r-- | isys/isys.c | 47 | ||||
-rw-r--r-- | isys/isys.py | 3 |
2 files changed, 50 insertions, 0 deletions
diff --git a/isys/isys.c b/isys/isys.c index a5341184d..66fe99334 100644 --- a/isys/isys.c +++ b/isys/isys.c @@ -36,6 +36,7 @@ static PyObject * doCheckBoot(PyObject * s, PyObject * args); static PyObject * doCheckUFS(PyObject * s, PyObject * args); static PyObject * doSwapon(PyObject * s, PyObject * args); static PyObject * doPoptParse(PyObject * s, PyObject * args); +static PyObject * doFbconProbe(PyObject * s, PyObject * args); static PyMethodDef isysModuleMethods[] = { { "findmoduleinfo", (PyCFunction) doFindModInfo, METH_VARARGS, NULL }, @@ -62,6 +63,7 @@ static PyMethodDef isysModuleMethods[] = { { "checkBoot", (PyCFunction) doCheckBoot, METH_VARARGS, NULL }, { "checkUFS", (PyCFunction) doCheckUFS, METH_VARARGS, NULL }, { "swapon", (PyCFunction) doSwapon, METH_VARARGS, NULL }, + { "fbconprobe", (PyCFunction) doFbconProbe, METH_VARARGS, NULL }, { NULL } } ; @@ -736,3 +738,48 @@ static PyObject * doPoptParse(PyObject * s, PyObject * args) { return list; } + +#include <linux/fb.h> + +static PyObject * doFbconProbe (PyObject * s, PyObject * args) { + char * path; + int fd, size; + PyObject * ret; + struct fb_fix_screeninfo fix; + static int vidRam[8], idx = -1; + + if (!PyArg_ParseTuple(args, "s", &path)) return NULL; + + /* Cache the results, because after X is fired off + the device may be busy */ + if (!strncmp (path, "/dev/fb", 7) && path[7] >= '0' && + path[7] <= '7') { + idx = path[7] - '0'; + if (vidRam[idx]) + return Py_BuildValue("i", vidRam[idx]); + } + + if ((fd = open (path, O_RDONLY)) < 0) { + PyErr_SetFromErrno(PyExc_SystemError); + return NULL; + } + + if (ioctl(fd, FBIOGET_FSCREENINFO, &fix) < 0) { + close (fd); + PyErr_SetFromErrno(PyExc_SystemError); + return NULL; + } + + close (fd); + /* Allow 64K from VIDRAM to be taken for other purposes */ + size = fix.smem_len + 65536; + /* And round down to some multiple of 256K */ + size = size & ~0x3ffff; + /* And report in KB */ + size >>= 10; + + if (idx != -1) + vidRam[idx] = size; + + return Py_BuildValue("i", size); +} diff --git a/isys/isys.py b/isys/isys.py index 0e5929389..1fbf4a797 100644 --- a/isys/isys.py +++ b/isys/isys.py @@ -19,6 +19,9 @@ def checkBoot (path): def swapon (path): return _isys.swapon (path) +def fbconProbe(path): + return _isys.fbconprobe (path) + def probePciDevices(): # probes all probeable buses and returns a list of # ( driver, major, minor, description, args ) tuples, where args is a |