пятница, 26 октября 2012 г.

dropbox and browser

dropbox on Debian launches x-www-browser to open its website. Unfortunately x-www-browser is set for whole system and user can't change it. But he can choose his own preferred browser and then invoke it by invoking sensible-browser. Fortunately dropbox first tries to execute x-www-browser from its installation, and as there is no such file, falls back to executing /usr/bin/x-www-browser. So issue can be solved by:

# ln -s /usr/bin/sensible-browser /var/lib/dropbox/.dropbox-dist/x-www-browser

One can set preferred browser by setting up evironment variable BROWSER (in .profile or .bashrc, for example).

суббота, 22 сентября 2012 г.

Add current directory to GTK+ file open dialog

Now GTK+ file open dialog offers no way to open file from current working directory. One can find recent documents, home directory or some other bookmarks. Quite frustrating when you know for sure where file you need is, but forced to traverse directory tree to current working directory.

Recently I found workaround. Solution is to add /proc/self/cwd as bookmark. Unfortunately path will be displayed as /proc/self/cwd, not actual cwd, but anyway, it works!

суббота, 21 июля 2012 г.

Simple maze solver with python and pyside

I'm practicing in Python, PySide and some algorithms. You can find a simple maze generator/solver below.





from PySide.QtCore import *
from PySide.QtGui import *
import sys
import random
 
class Maze(QWidget):
    def __init__(self, width, height, boxsize=7):
        QWidget.__init__(self)
 
        self.setMazeSize(width, height, boxsize)
        self.generateMazeDFS()
 
    def setMazeSize(self, width, height, boxsize):
        self.maze_width = width
        self.maze_height = height
        self.boxsize = boxsize
        self.setFixedSize(width * boxsize + 10, height * boxsize + 10)
 
    def generateMazeDumb(self, width=None, height=None, sparseness=None):
        if width is None: width = self.maze_width
        if height is None: height = self.maze_height
        if sparseness is None: sparseness = 2
 
        self.vwall = [[random.randint(0,sparseness) for x in range(0, width+1)] for y in range(0, height)]
        self.hwall = [[random.randint(0,sparseness) for x in range(0, width)] for y in range(0, height+1)]
        for x in range(0, width):
            self.hwall[0][x] = 0
            self.hwall[height][x] = 0
        for y in range(0, height):
            self.vwall[y][0] = 0
            self.vwall[y][width] = 0
 
    def generateMazeDFS(self, width=None, height=None, seed_point=None):
        if width is None: width = self.maze_width
        if height is None: height = self.maze_height
        if seed_point is None: seed_point = (random.randint(0, width-1), random.randint(0, height-1))
 
        self.vwall = [[0 for x in range(0, width+1)] for y in range(0, height)]
        self.hwall = [[0 for x in range(0, width)] for y in range(0, height+1)]
 
        maze = [[0 for x in range(0, self.maze_width)] for y in range(0, self.maze_height)]
 
        path = [seed_point]
        while True:
            possible_moves = []
            x, y = path[-1]
 
            if x > 0 and maze[y][x-1] == 0: possible_moves.append('left')
            if x < width-1 and maze[y][x+1] == 0: possible_moves.append('right')
            if y > 0 and maze[y-1][x] == 0: possible_moves.append('up')
            if y < height-1 and maze[y+1][x] == 0: possible_moves.append('down')
 
            if len(possible_moves) > 0:
                next_move = random.choice(possible_moves)
                maze[y][x] = 1
                if next_move == 'left':
                    self.vwall[y][x] = 1
                    path.append((x-1, y))
                    continue
                elif next_move == 'right':
                    self.vwall[y][x+1] = 1
                    path.append((x+1, y))
                    continue
                elif next_move == 'up':
                    self.hwall[y][x] = 1
                    path.append((x, y-1))
                    continue
                elif next_move == 'down':
                    self.hwall[y+1][x] = 1
                    path.append((x, y+1))
                    continue
            else:
                maze[y][x] = -1
                path.pop()
                if len(path) == 0:
                    break
 
    def paintEvent(self, event):
        qp = QPainter()
        qp.begin(self)
        qp.fillRect(0, 0, self.maze_width * self.boxsize + 10, self.maze_height * self.boxsize + 10, Qt.black)
 
        qp.translate(QPoint(5.5, 5.5))
        qp.setPen(Qt.white)
        b = self.boxsize
 
        # vertical walls
        y = 0
        for row in self.vwall:
            x = 0
            for w in row:
                if w == 0: qp.drawLine(x*b, y*b, x*b, (y+1)*b)
                x += 1
            y += 1
 
        # horizontal walls
        y = 0
        for row in self.hwall:
            x = 0
            for w in row:
                if w == 0: qp.drawLine(x*b, y*b, (x+1)*b, y*b)
                x += 1
            y += 1
 
        # path
        prev = None
        for point in self.path:
            x1 = point[0]
            y1 = point[1]
            if prev:
                x2 = prev[0]
                y2 = prev[1]
                qp.fillRect(b*min(x1,x2) + 2, b*min(y1,y2) + 2, b*abs(x1-x2)+b-4, b*abs(y1-y2)+b-4, Qt.green)
            else:
                qp.fillRect(x*b+2, y*b+2, b-4, b-4, Qt.green)
            prev = point
 
        # visited cells
        y = 0
        for row in self.maze:
            x = 0
            for m in row:
                if m == -1: qp.fillRect(x*b+2, y*b+2, b-3, b-3, Qt.gray)
                x += 1
            y += 1
 
        # target
        x, y = self.target
        qp.fillRect(x*b+2, y*b+2, b-3, b-3, Qt.red)
 
        # status
        if self.status:
            qp.setPen(Qt.white)
            qp.setFont(QFont("sans", 72, QFont.Normal))
            qp.drawText(QRect(0, 0, self.maze_width * b, self.maze_height * b),
                Qt.AlignCenter | Qt.AlignVCenter,
                self.status)
 
        qp.end()
 
    def step(self):
        self.step_num += 1
        x, y = self.path[-1]
 
        if (x, y) == self.target:
            self.status = "win"
            return False
 
        if self.step_select == 'random':
            order_list = ['u', 'r', 'd', 'l']
            random.shuffle(order_list)
        else:
            order_list = self.step_select
 
        for order in order_list:
            if order == 'u':
                # try step up
                if y > 0 and self.hwall[y][x] != 0 and self.maze[y-1][x] == 0:
                    self.path.append((x, y-1))
                    self.maze[y-1][x] = self.step_num
                    return True
            elif order == 'r':
                # try step right
                if x < self.maze_width-1 and self.vwall[y][x+1] != 0 and self.maze[y][x+1] == 0:
                    self.path.append((x+1, y))
                    self.maze[y][x+1] = self.step_num
                    return True
            elif order == 'd':
                # try step down
                if y < self.maze_height-1 and self.hwall[y+1][x] != 0 and self.maze[y+1][x] == 0:
                    self.path.append((x, y+1))
                    self.maze[y+1][x] = self.step_num
                    return True
            elif order == 'l':
                # try step left
                if x > 0 and self.vwall[y][x] != 0 and self.maze[y][x-1] == 0:
                    self.path.append((x-1, y))
                    self.maze[y][x-1] = self.step_num
                    return True
 
        # step back
        self.maze[y][x] = -1
        self.path.pop()
 
        if len(self.path) == 0:
            self.status = "loss"
            return False
 
        return True
 
    def init(self):
        self.maze = [[0 for x in range(0, self.maze_width)] for y in range(0, self.maze_height)]
        self.path = [(0, 0)]
        self.step_num = 1
        x, y = self.path[0]
        self.maze[y][x] = 1
        self.target = (self.maze_width-1, self.maze_height-1)
        self.status = False
 
 
class MainWindow(QMainWindow):
    def __init__(self):
        QMainWindow.__init__(self)
        self.setWindowTitle("Maze")
 
        self.maze = Maze(150, 80, 7)
 
        hbox = QHBoxLayout()
        hbox.setContentsMargins(0, 0, 10, 0)
        hbox.addWidget(self.maze)
        vbox = QVBoxLayout()
        vbox.setContentsMargins(0, 10, 0, 0)
        hbox.addLayout(vbox)
 
        self.le_w = QLineEdit("150")
        vbox.addWidget(QLabel("maze width:"))
        vbox.addWidget(self.le_w)
        self.le_h = QLineEdit("80")
        vbox.addWidget(QLabel("maze height:"))
        vbox.addWidget(self.le_h)
        self.le_b = QLineEdit("7")
        vbox.addWidget(QLabel("cell size:"))
        vbox.addWidget(self.le_b)
 
        self.dm_sparse = QLineEdit("2")
        vbox.addWidget(QLabel("Dumb mode sparseness:"))
        vbox.addWidget(self.dm_sparse)
 
        self.maze_type = QButtonGroup()
        rb_1 = QRadioButton("Dumb random maze")
        rb_1.setChecked(True)
        rb_2 = QRadioButton("DFS maze generator")
        self.maze_type.addButton(rb_1, 0)
        self.maze_type.addButton(rb_2, 1)
        vbox.addWidget(rb_1)
        vbox.addWidget(rb_2)
 
        self.btn_generate = QPushButton("Generate")
        self.btn_generate.clicked.connect(self.generateMaze)
        vbox.addWidget(self.btn_generate)
 
        self.step_order = QLineEdit("random")
        self.step_order.setPlaceholderText("step order")
        vbox.addWidget(self.step_order)
 
        self.btn_solve = QPushButton("Solve")
        self.btn_solve.clicked.connect(self.startSolving)
        vbox.addWidget(self.btn_solve)
 
        self.btn_stop = QPushButton("Stop")
        self.btn_stop.setEnabled(False)
        self.btn_stop.clicked.connect(self.stopSolving)
        vbox.addWidget(self.btn_stop)
 
        vbox.addStretch()
 
        proxy_widget = QWidget()
        proxy_widget.setLayout(hbox)
        self.setCentralWidget(proxy_widget)
 
        self.maze.init()
 
    def doStep(self):
        for k in range(0, 50):
            if not self.maze.step():
                self.timer.stop()
                self.stopSolving()
                break
        self.maze.repaint()
 
    def startSolving(self):
        self.btn_solve.setEnabled(False)
        self.btn_stop.setEnabled(True)
        self.btn_generate.setEnabled(False)
        self.maze.init()
 
        self.maze.step_select = self.step_order.text()
        if self.maze.step_select == '':
            self.maze.step_select = 'random'
 
        self.timer = QTimer(self)
        self.timer.timeout.connect(self.doStep)
        self.timer.setInterval(50)
        self.timer.start()
 
    def stopSolving(self):
        self.btn_stop.setEnabled(False)
        self.btn_solve.setEnabled(True)
        self.btn_generate.setEnabled(True)
        self.timer.stop()
 
    def generateMaze(self):
        w = max(2, int(self.le_w.text()))
        h = max(2, int(self.le_h.text()))
        b = max(5, int(self.le_b.text()))
        sparseness = max(0, int(self.dm_sparse.text()))
 
        self.maze.setMazeSize(w, h, b)
        self.maze.init()
 
        if self.maze_type.checkedId() == 0:
            self.maze.generateMazeDumb(sparseness=sparseness)
        elif self.maze_type.checkedId() == 1:
            self.maze.generateMazeDFS()
        self.maze.repaint()
 
 
app = QApplication(sys.argv)
 
mw = MainWindow()
mw.show()
 
sys.exit(app.exec_())
 


пятница, 20 июля 2012 г.

CX_Find_Cell_With_Point and 3ddp (Fluent)

There is a function CX_Find_Cell_With_Point. It's not listed in official documentation but it works well when you need to find a cell which contains specified point. Otherwise one must use very slow dumb search or develop  some sofisticated search algorithms. But there is a glitch with its use. As it's undocumented, there is no guarantee that it even compiles.
`CX_Find_Cell_With_Point' does not work with double precision (3ddp) Fluent solver!
That's true for Fluent 6.2.16 on lnamd64 (at least). With 3ddp it always returns NULL.

And if you're here for example, here is a code:

#include "udf.h"
#include "surf.h"
#include "para.h"
 
void some_function()
{
    cell_t c;
    Thread *t;
    CX_Cell_Id cx_cell;
    CX_Cell_Id *cx_cell_ptr;
    real pt[3];
 
    CX_Start_ND_Point_Search(); /* call this before actual search */
                                /* perhaps it'll do some initializations */
    for (k = 0; k < 1000; k ++) {
        /* fill pt[3] with data */
        pt[0] = 0.0; pt[1] = 0.0; pt[2] = k / 1000.0;
 
        /* perform search */
        cx_cell_ptr = CX_Find_Cell_With_Point(pt);
        if (cx_cell_ptr) {   /* function can return NULL if no cell was found */
            cx_cell = *cx_cell_ptr;
            c = RP_CELL(&cx_cell);  /* get cell number */
            t = RP_THREAD(&cx_cell);  /* get cell thread */
 
            /* ... do your calculations ... */
 
        } else {
            /* no cell was found */
        }
 
    }
 
    /* It's a good practice to clean up */
    CX_End_ND_Point_Search();
}
 

пятница, 13 июля 2012 г.

another fluent 3ddp parallel benchmark

Another fluent 3ddp benchmark on Phenom II X6 1090T.
Unfortunatelly I don't remember what case was used.

procs; time per iteration; wall time; cpu time

smpi:
1 4.577 457.661 457.330
2 2.488 248.802 496.820
3 1.792 179.155 536.430
4 1.475 147.455 587.010
5 1.221 122.108 605.510
6 1.081 108.132 632.970
7 2.314 231.399 1202.540

nmpi:
5 1.569 156.866 669.320 nmpi
6 1.253 125.323 648.960 nmpi
7 3.235 323.487 1728.310 nmpi



пятница, 22 июня 2012 г.

XKeysymDB

Someday upstream developers decided to remove XKeysymDB from libx11-data. But there still old (motif-based) applications exists that relies on that file. In my case application ignored any input from keyboard making it impossible to use it anyhow.

Just for reference here is how those errors look like:


Warning: translation table syntax error: Unknown keysym name:  osfActivate
Warning: ... found while parsing ':<Key>osfActivate:  ManagerParentActivate()'
Warning: String to TranslationTable conversion encountered errors
Warning: translation table syntax error: Unknown keysym name:  osfBeginLine
Warning: ... found while parsing ':<Key>osfBeginLine:  ManagerGadgetTraverseHome()'
Warning: String to TranslationTable conversion encountered errors
Warning: translation table syntax error: Unknown keysym name:  osfHelp
Warning: ... found while parsing ':<Key>osfHelp:   ManagerGadgetHelp()'
Warning: String to TranslationTable conversion encountered errors
Warning: translation table syntax error: Unknown keysym name:  osfActivate
Warning: ... found while parsing ':<Key>osfActivate: PrimitiveParentActivate()'
Warning: String to TranslationTable conversion encountered errors
Warning: translation table syntax error: Unknown keysym name:  osfHelp
Warning: ... found while parsing ':<Key>osfHelp:  Help()'
Warning: String to TranslationTable conversion encountered errors
Warning: translation table syntax error: Unknown keysym name:  osfActivate
Warning: ... found while parsing ':<Key>osfActivate: PrimitiveParentActivate()'
Warning: String to TranslationTable conversion encountered errors
Warning: translation table syntax error: Unknown keysym name:  osfCancel
Warning: ... found while parsing ':<Key>osfCancel: MenuEscape()'
Warning: String to TranslationTable conversion encountered errors
Warning: translation table syntax error: Unknown keysym name:  osfActivate
Warning: ... found while parsing ':<Key>osfActivate: PrimitiveParentActivate()'
Warning: String to TranslationTable conversion encountered errors
Warning: translation table syntax error: Unknown keysym name:  osfSelect
Warning: ... found while parsing ':<Key>osfSelect: ArmAndActivate()'
Warning: String to TranslationTable conversion encountered errors
Warning: translation table syntax error: Unknown keysym name:  osfSelect
Warning: ... found while parsing ':<Key>osfSelect: ManagerGadgetSelect()'
Warning: String to TranslationTable conversion encountered errors
Warning: translation table syntax error: Unknown keysym name:  osfSelect
Warning: ... found while parsing ':<Key>osfSelect: MenuBarGadgetSelect()'
Warning: String to TranslationTable conversion encountered errors
Warning: translation table syntax error: Unknown keysym name:  osfActivate
Warning: ... found while parsing ':<Key>osfActivate: ManagerParentActivate()'
Warning: String to TranslationTable conversion encountered errors
Warning: translation table syntax error: Unknown keysym name:  osfHelp
Warning: ... found while parsing ':<Key>osfHelp:  MenuHelp()'
Warning: String to TranslationTable conversion encountered errors
Warning: translation table syntax error: Unknown keysym name:  osfSelect
Warning: ... found while parsing ':<Key>osfSelect: KeySelect()'
Warning: String to TranslationTable conversion encountered errors
Warning: translation table syntax error: Unknown keysym name:  osfSelect
Warning: ... found while parsing ':<Key>osfSelect: KeySelect()'
Warning: String to TranslationTable conversion encountered errors
Warning: translation table syntax error: Unknown keysym name:  osfCancel
Warning: ... found while parsing '<Key>osfCancel:   MenuEscape()'
Warning: String to TranslationTable conversion encountered errors
Warning: translation table syntax error: Unknown keysym name:  osfSelect
Warning: ... found while parsing ':<Key>osfSelect: ArmAndActivate()'
Warning: String to TranslationTable conversion encountered errors
Warning: translation table syntax error: Unknown keysym name:  osfActivate
Warning: ... found while parsing ':<Key>osfActivate:  PrimitiveParentActivate()'
Warning: String to TranslationTable conversion encountered errors
Warning: translation table syntax error: Unknown keysym name:  osfActivate
Warning: ... found while parsing ':<Key>osfActivate: ManagerParentActivate()'
Warning: String to TranslationTable conversion encountered errors
Warning: translation table syntax error: Unknown keysym name:  osfActivate
Warning: ... found while parsing ':<Key>osfActivate: DrawingAreaInput() ManagerParentActivate()'
Warning: String to TranslationTable conversion encountered errors
Warning: translation table syntax error: Unknown keysym name:  osfUp
Warning: ... found while parsing ':<Key>osfUp:  DrawingAreaInput() ManagerGadgetTraverseUp()'
Warning: String to TranslationTable conversion encountered errors
Warning: translation table syntax error: Unknown keysym name:  osfBeginLine
Warning: ... found while parsing ':c <Key>osfBeginLine: ActionGrab(SWTopLine)'
Warning: String to TranslationTable conversion encountered errors
Warning: translation table syntax error: Unknown keysym name:  osfActivate
Warning: ... found while parsing ':<Key>osfActivate:  PrimitiveParentActivate()'
Warning: String to TranslationTable conversion encountered errors


So here it is, /usr/share/X11/XKeysymDB
! Copyright 1993 Massachusetts Institute of Technology
!
! Permission to use, copy, modify, distribute, and sell this software and
! its documentation for any purpose is hereby granted without fee, provided
! that the above copyright notice appear in all copies and that both that
! copyright notice and this permission notice appear in supporting
! documentation, and that the name of M.I.T. not be used in advertising or
! publicity pertaining to distribution of the software without specific,
! written prior permission.  M.I.T. makes no representations about the
! suitability of this software for any purpose.  It is provided "as is"
! without express or implied warranty.
!

hpmute_acute  :100000A8
hpmute_grave  :100000A9
hpmute_asciicircum :100000AA
hpmute_diaeresis :100000AB
hpmute_asciitilde :100000AC
hplira   :100000AF
hpguilder  :100000BE
hpYdiaeresis  :100000EE
hpIO   :100000EE
hplongminus  :100000F6
hpblock   :100000FC
apLineDel  :1000FF00
apCharDel  :1000FF01
apCopy   :1000FF02
apCut   :1000FF03
apPaste   :1000FF04
apMove   :1000FF05
apGrow   :1000FF06
apCmd   :1000FF07
apShell   :1000FF08
apLeftBar  :1000FF09
apRightBar  :1000FF0A
apLeftBox  :1000FF0B
apRightBox  :1000FF0C
apUpBox   :1000FF0D
apDownBox  :1000FF0E
apPop   :1000FF0F
apRead   :1000FF10
apEdit   :1000FF11
apSave   :1000FF12
apExit   :1000FF13
apRepeat  :1000FF14
hpModelock1  :1000FF48
hpModelock2  :1000FF49
hpReset   :1000FF6C
hpSystem  :1000FF6D
hpUser   :1000FF6E
hpClearLine  :1000FF6F
hpInsertLine  :1000FF70
hpDeleteLine  :1000FF71
hpInsertChar  :1000FF72
hpDeleteChar  :1000FF73
hpBackTab  :1000FF74
hpKP_BackTab  :1000FF75
apKP_parenleft  :1000FFA8
apKP_parenright  :1000FFA9

I2ND_FUNC_L  :10004001
I2ND_FUNC_R  :10004002
IREMOVE   :10004003
IREPEAT   :10004004
IA1   :10004101
IA2   :10004102
IA3   :10004103
IA4   :10004104
IA5   :10004105
IA6   :10004106
IA7   :10004107
IA8   :10004108
IA9   :10004109
IA10   :1000410A
IA11   :1000410B
IA12   :1000410C
IA13   :1000410D
IA14   :1000410E
IA15   :1000410F
IB1   :10004201
IB2   :10004202
IB3   :10004203
IB4   :10004204
IB5   :10004205
IB6   :10004206
IB7   :10004207
IB8   :10004208
IB9   :10004209
IB10   :1000420A
IB11   :1000420B
IB12   :1000420C
IB13   :1000420D
IB14   :1000420E
IB15   :1000420F
IB16   :10004210

DRemove   :1000FF00
Dring_accent  :1000FEB0
Dcircumflex_accent :1000FE5E
Dcedilla_accent  :1000FE2C
Dacute_accent  :1000FE27
Dgrave_accent  :1000FE60
Dtilde   :1000FE7E
Ddiaeresis  :1000FE22

osfCopy   :1004FF02
osfCut   :1004FF03
osfPaste  :1004FF04
osfBackTab  :1004FF07
osfBackSpace  :1004FF08
osfClear  :1004FF0B
osfEscape  :1004FF1B
osfAddMode  :1004FF31
osfPrimaryPaste  :1004FF32
osfQuickPaste  :1004FF33
osfPageLeft  :1004FF40
osfPageUp  :1004FF41
osfPageDown  :1004FF42
osfPageRight  :1004FF43
osfActivate  :1004FF44
osfMenuBar  :1004FF45
osfLeft   :1004FF51
osfUp   :1004FF52
osfRight  :1004FF53
osfDown   :1004FF54
osfPrior  :1004FF55
osfNext   :1004FF56
osfEndLine  :1004FF57
osfBeginLine  :1004FF58
osfEndData  :1004FF59
osfBeginData  :1004FF5A
osfPrevMenu  :1004FF5B
osfNextMenu  :1004FF5C
osfPrevField  :1004FF5D
osfNextField  :1004FF5E
osfSelect  :1004FF60
osfInsert  :1004FF63
osfUndo   :1004FF65
osfMenu   :1004FF67
osfCancel  :1004FF69
osfHelp   :1004FF6A
osfSelectAll  :1004FF71
osfDeselectAll  :1004FF72
osfReselect  :1004FF73
osfExtend  :1004FF74
osfRestore  :1004FF78
osfSwitchDirection :1004FF7E
osfPriorMinor  :1004FFF5
osfNextMinor  :1004FFF6
osfRightLine  :1004FFF7
osfLeftLine  :1004FFF8
osfDelete  :1004FFFF

SunFA_Grave  :1005FF00
SunFA_Circum  :1005FF01
SunFA_Tilde  :1005FF02
SunFA_Acute  :1005FF03
SunFA_Diaeresis  :1005FF04
SunFA_Cedilla  :1005FF05
SunF36   :1005FF10
SunF37   :1005FF11
SunSys_Req  :1005FF60
SunProps  :1005FF70
SunFront  :1005FF71
SunCopy   :1005FF72
SunOpen   :1005FF73
SunPaste  :1005FF74
SunCut   :1005FF75
SunPowerSwitch  :1005FF76
SunAudioLowerVolume :1005FF77
SunAudioMute  :1005FF78
SunAudioRaiseVolume :1005FF79
SunVideoDegauss  :1005FF7A
SunVideoLowerBrightness :1005FF7B
SunVideoRaiseBrightness :1005FF7C
SunPowerSwitchShift :1005FF7D

SunCompose  :FF20
SunPageUp  :FF55
SunPageDown  :FF56
SunPrint_Screen  :FF61
SunUndo   :FF65
SunAgain  :FF66
SunFind   :FF68
SunStop   :FF69
SunAltGraph  :FF7E

WYSetup   :1006FF00

ncdSetup  :1006FF00

XeroxPointerButton1 :10070001
XeroxPointerButton2 :10070002
XeroxPointerButton3 :10070003
XeroxPointerButton4 :10070004
XeroxPointerButton5 :10070005

! The definitions here should match <X11/XF86keysym.h>
XF86ModeLock  :1008FF01
XF86MonBrightnessUp :1008FF02
XF86MonBrightnessDown :1008FF03
XF86KbdLightOnOff :1008FF04
XF86KbdBrightnessUp :1008FF05
XF86KbdBrightnessDown :1008FF06
XF86Standby  :1008FF10
XF86AudioLowerVolume :1008FF11
XF86AudioMute  :1008FF12
XF86AudioRaiseVolume :1008FF13
XF86AudioPlay  :1008FF14
XF86AudioStop  :1008FF15
XF86AudioPrev  :1008FF16
XF86AudioNext  :1008FF17
XF86HomePage  :1008FF18
XF86Mail  :1008FF19
XF86Start  :1008FF1A
XF86Search  :1008FF1B
XF86AudioRecord  :1008FF1C
XF86Calculator  :1008FF1D
XF86Memo  :1008FF1E
XF86ToDoList  :1008FF1F
XF86Calendar  :1008FF20
XF86PowerDown  :1008FF21
XF86ContrastAdjust :1008FF22
XF86RockerUp  :1008FF23
XF86RockerDown  :1008FF24
XF86RockerEnter  :1008FF25
XF86Back  :1008FF26
XF86Forward  :1008FF27
XF86Stop  :1008FF28
XF86Refresh  :1008FF29
XF86PowerOff  :1008FF2A
XF86WakeUp  :1008FF2B
XF86Eject               :1008FF2C
XF86ScreenSaver         :1008FF2D
XF86WWW                 :1008FF2E
XF86Sleep               :1008FF2F
XF86Favorites  :1008FF30
XF86AudioPause  :1008FF31
XF86AudioMedia  :1008FF32
XF86MyComputer  :1008FF33
XF86VendorHome  :1008FF34
XF86LightBulb  :1008FF35
XF86Shop  :1008FF36
XF86History  :1008FF37
XF86OpenURL  :1008FF38
XF86AddFavorite  :1008FF39
XF86HotLinks  :1008FF3A
XF86BrightnessAdjust :1008FF3B
XF86Finance  :1008FF3C
XF86Community  :1008FF3D
XF86AudioRewind  :1008FF3E
XF86BackForward  :1008FF3F
XF86Launch0  :1008FF40
XF86Launch1  :1008FF41
XF86Launch2  :1008FF42
XF86Launch3  :1008FF43
XF86Launch4  :1008FF44
XF86Launch5  :1008FF45
XF86Launch6  :1008FF46
XF86Launch7  :1008FF47
XF86Launch8  :1008FF48
XF86Launch9  :1008FF49
XF86LaunchA  :1008FF4A
XF86LaunchB  :1008FF4B
XF86LaunchC  :1008FF4C
XF86LaunchD  :1008FF4D
XF86LaunchE  :1008FF4E
XF86LaunchF  :1008FF4F
XF86ApplicationLeft :1008FF50
XF86ApplicationRight :1008FF51
XF86Book  :1008FF52
XF86CD   :1008FF53
XF86Calculater  :1008FF54
XF86Clear  :1008FF55
XF86Close  :1008FF56
XF86Copy  :1008FF57
XF86Cut   :1008FF58
XF86Display  :1008FF59
XF86DOS   :1008FF5A
XF86Documents  :1008FF5B
XF86Excel  :1008FF5C
XF86Explorer  :1008FF5D
XF86Game  :1008FF5E
XF86Go   :1008FF5F
XF86iTouch  :1008FF60
XF86LogOff  :1008FF61
XF86Market  :1008FF62
XF86Meeting  :1008FF63
XF86MenuKB  :1008FF65
XF86MenuPB  :1008FF66
XF86MySites  :1008FF67
XF86New   :1008FF68
XF86News  :1008FF69
XF86OfficeHome  :1008FF6A
XF86Open  :1008FF6B
XF86Option  :1008FF6C
XF86Paste  :1008FF6D
XF86Phone  :1008FF6E
XF86Q   :1008FF70
XF86Reply  :1008FF72
XF86Reload  :1008FF73
XF86RotateWindows :1008FF74
XF86RotationPB  :1008FF75
XF86RotationKB  :1008FF76
XF86Save  :1008FF77
XF86ScrollUp  :1008FF78
XF86ScrollDown  :1008FF79
XF86ScrollClick  :1008FF7A
XF86Send  :1008FF7B
XF86Spell  :1008FF7C
XF86SplitScreen  :1008FF7D
XF86Support  :1008FF7E
XF86TaskPane  :1008FF7F
XF86Terminal  :1008FF80
XF86Tools  :1008FF81
XF86Travel  :1008FF82
XF86UserPB  :1008FF84
XF86User1KB  :1008FF85
XF86User2KB  :1008FF86
XF86Video  :1008FF87
XF86WheelButton  :1008FF88
XF86Word  :1008FF89
XF86Xfer  :1008FF8A
XF86ZoomIn  :1008FF8B
XF86ZoomOut  :1008FF8C
XF86Away  :1008FF8D
XF86Messenger  :1008FF8E
XF86WebCam  :1008FF8F
XF86MailForward  :1008FF90
XF86Pictures  :1008FF91
XF86Music  :1008FF92
XF86Battery  :1008FF93
XF86Bluetooth  :1008FF94
XF86WLAN  :1008FF95
XF86UWB   :1008FF96
XF86AudioForward :1008FF97
XF86AudioRepeat  :1008FF98
XF86AudioRandomPlay :1008FF99
XF86Subtitle  :1008FF9A
XF86AudioCycleTrack :1008FF9B
XF86CycleAngle  :1008FF9C
XF86FrameBack  :1008FF9D
XF86FrameForward :1008FF9E
XF86Time  :1008FF9F
XF86Select  :1008FFA0
XF86View  :1008FFA1
XF86TopMenu  :1008FFA2
XF86Red   :1008FFA3
XF86Green  :1008FFA4
XF86Yellow  :1008FFA5
XF86Blue              :1008FFA6
XF86Suspend  :1008FFA7
XF86Hibernate  :1008FFA8
XF86TouchpadToggle :1008FFA9

! XFree86 special action keys
XF86_Switch_VT_1 :1008FE01
XF86_Switch_VT_2 :1008FE02
XF86_Switch_VT_3 :1008FE03
XF86_Switch_VT_4 :1008FE04
XF86_Switch_VT_5 :1008FE05
XF86_Switch_VT_6 :1008FE06
XF86_Switch_VT_7 :1008FE07
XF86_Switch_VT_8 :1008FE08
XF86_Switch_VT_9 :1008FE09
XF86_Switch_VT_10 :1008FE0A
XF86_Switch_VT_11 :1008FE0B
XF86_Switch_VT_12 :1008FE0C
XF86_Ungrab  :1008FE20
XF86_ClearGrab  :1008FE21
XF86_Next_VMode  :1008FE22
XF86_Prev_VMode  :1008FE23

usldead_acute  :100000A8
usldead_grave  :100000A9
usldead_diaeresis :100000AB
usldead_asciicircum :100000AA
usldead_asciitilde :100000AC
usldead_cedilla  :1000FE2C
usldead_ring  :1000FEB0

вторник, 3 апреля 2012 г.

Linux on Clevo E4105

I'm currently running Debian Wheezy (testing) on Clevo E4105. Almost everything works out of the box. Although there was some quirks with hardware with previous kernel versions.

Kernel 2.6.39 and older missed support for wireless network card (RTL8192SE, identified by lspci as RTL8191SEvB). The driver from official site has bug in power saving code which resulted in random hangs. Cleaned version included in kernel 3.0 works well. Somewhere in 3.1, same bug was introduced. But 3.2 is ok again.

Other hardware, webcam, cardreader, ethernet NIC, dvd-rom, sound, usb controller works out of the box. I haven't tested modem or HDMI output, but some version of Ubuntu LiveCD asked me if I want to install proprietary driver for modem. And xrandr output implies that HDMI support exists.

Screen is 14" size with 1366x768 resolution (which is 112 dpi). View angles are terrible, as one can expect from TN screen, and it's a bit bluish.

Platform keys (those with Fn+something). Volume up/down/mute, play/pause, video switch, sleep button, all produce ACPI events, while touchpad disable, screen off/on, webcam on/off, wireless on/off works on lower level (I think, firmware). Unfortunately brightness can't be changed with keys as they produce no effect. Brightness itself can be changed via `xbacklight` or by writing to /sys/class/backlight/acpi_video0/brightness.


Here is lspci output:
$ lspci -nnv
00:00.0 Host bridge [0600]: Intel Corporation Core Processor DRAM Controller [8086:0044] (rev 02)
 Subsystem: CLEVO/KAPOK Computer Device [1558:4101]
 Flags: bus master, fast devsel, latency 0
 Capabilities: <access denied>
 Kernel driver in use: agpgart-intel

00:02.0 VGA compatible controller [0300]: Intel Corporation Core Processor Integrated Graphics Controller [8086:0046] (rev 02) (prog-if 00 [VGA controller])
 Subsystem: CLEVO/KAPOK Computer Device [1558:4101]
 Flags: bus master, fast devsel, latency 0, IRQ 41
 Memory at f2000000 (64-bit, non-prefetchable) [size=4M]
 Memory at d0000000 (64-bit, prefetchable) [size=256M]
 I/O ports at 1800 [size=8]
 Expansion ROM at <unassigned> [disabled]
 Capabilities: <access denied>
 Kernel driver in use: i915

00:16.0 Communication controller [0780]: Intel Corporation 5 Series/3400 Series Chipset HECI Controller [8086:3b64] (rev 06)
 Subsystem: CLEVO/KAPOK Computer Device [1558:4101]
 Flags: bus master, fast devsel, latency 0, IRQ 11
 Memory at f2804000 (64-bit, non-prefetchable) [size=16]
 Capabilities: <access denied>

00:1a.0 USB controller [0c03]: Intel Corporation 5 Series/3400 Series Chipset USB2 Enhanced Host Controller [8086:3b3c] (rev 05) (prog-if 20 [EHCI])
 Subsystem: CLEVO/KAPOK Computer Device [1558:4101]
 Flags: bus master, medium devsel, latency 0, IRQ 16
 Memory at f2806000 (32-bit, non-prefetchable) [size=1K]
 Capabilities: <access denied>
 Kernel driver in use: ehci_hcd

00:1b.0 Audio device [0403]: Intel Corporation 5 Series/3400 Series Chipset High Definition Audio [8086:3b56] (rev 05)
 Subsystem: CLEVO/KAPOK Computer Device [1558:4101]
 Flags: bus master, fast devsel, latency 0, IRQ 42
 Memory at f2800000 (64-bit, non-prefetchable) [size=16K]
 Capabilities: <access denied>
 Kernel driver in use: snd_hda_intel

00:1c.0 PCI bridge [0604]: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 1 [8086:3b42] (rev 05) (prog-if 00 [Normal decode])
 Flags: bus master, fast devsel, latency 0
 Bus: primary=00, secondary=02, subordinate=03, sec-latency=0
 I/O behind bridge: 00002000-00002fff
 Memory behind bridge: f1000000-f1ffffff
 Prefetchable memory behind bridge: 00000000f0000000-00000000f0ffffff
 Capabilities: <access denied>
 Kernel driver in use: pcieport

00:1c.1 PCI bridge [0604]: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 2 [8086:3b44] (rev 05) (prog-if 00 [Normal decode])
 Flags: bus master, fast devsel, latency 0
 Bus: primary=00, secondary=04, subordinate=04, sec-latency=0
 I/O behind bridge: 00003000-00003fff
 Memory behind bridge: f2400000-f24fffff
 Prefetchable memory behind bridge: 00000000bc200000-00000000bc3fffff
 Capabilities: <access denied>
 Kernel driver in use: pcieport

00:1c.2 PCI bridge [0604]: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 3 [8086:3b46] (rev 05) (prog-if 00 [Normal decode])
 Flags: bus master, fast devsel, latency 0
 Bus: primary=00, secondary=05, subordinate=05, sec-latency=0
 I/O behind bridge: 00004000-00004fff
 Memory behind bridge: f2500000-f25fffff
 Prefetchable memory behind bridge: 00000000bc000000-00000000bc1fffff
 Capabilities: <access denied>
 Kernel driver in use: pcieport

00:1d.0 USB controller [0c03]: Intel Corporation 5 Series/3400 Series Chipset USB2 Enhanced Host Controller [8086:3b34] (rev 05) (prog-if 20 [EHCI])
 Subsystem: CLEVO/KAPOK Computer Device [1558:4101]
 Flags: bus master, medium devsel, latency 0, IRQ 23
 Memory at f2807000 (32-bit, non-prefetchable) [size=1K]
 Capabilities: <access denied>
 Kernel driver in use: ehci_hcd

00:1e.0 PCI bridge [0604]: Intel Corporation 82801 Mobile PCI Bridge [8086:2448] (rev a5) (prog-if 01 [Subtractive decode])
 Flags: bus master, fast devsel, latency 0
 Bus: primary=00, secondary=06, subordinate=06, sec-latency=0
 Capabilities: <access denied>

00:1f.0 ISA bridge [0601]: Intel Corporation Mobile 5 Series Chipset LPC Interface Controller [8086:3b09] (rev 05)
 Subsystem: CLEVO/KAPOK Computer Device [1558:4101]
 Flags: bus master, medium devsel, latency 0
 Capabilities: <access denied>

00:1f.2 SATA controller [0106]: Intel Corporation 5 Series/3400 Series Chipset 4 port SATA AHCI Controller [8086:3b29] (rev 05) (prog-if 01 [AHCI 1.0])
 Subsystem: CLEVO/KAPOK Computer Device [1558:4101]
 Flags: bus master, 66MHz, medium devsel, latency 0, IRQ 40
 I/O ports at 1818 [size=8]
 I/O ports at 180c [size=4]
 I/O ports at 1810 [size=8]
 I/O ports at 1808 [size=4]
 I/O ports at 1820 [size=32]
 Memory at f2808000 (32-bit, non-prefetchable) [size=2K]
 Capabilities: <access denied>
 Kernel driver in use: ahci

00:1f.3 SMBus [0c05]: Intel Corporation 5 Series/3400 Series Chipset SMBus Controller [8086:3b30] (rev 05)
 Subsystem: CLEVO/KAPOK Computer Device [1558:4101]
 Flags: medium devsel, IRQ 18
 Memory at f2809000 (64-bit, non-prefetchable) [size=256]
 I/O ports at 1840 [size=32]

00:1f.6 Signal processing controller [1180]: Intel Corporation 5 Series/3400 Series Chipset Thermal Subsystem [8086:3b32] (rev 05)
 Subsystem: CLEVO/KAPOK Computer Device [1558:4101]
 Flags: fast devsel, IRQ 10
 Memory at f280a000 (64-bit, non-prefetchable) [size=4K]
 Capabilities: <access denied>

04:00.0 System peripheral [0880]: JMicron Technology Corp. SD/MMC Host Controller [197b:2382] (rev 80)
 Subsystem: CLEVO/KAPOK Computer Device [1558:4101]
 Flags: bus master, fast devsel, latency 0, IRQ 18
 Memory at f2404000 (32-bit, non-prefetchable) [size=256]
 Capabilities: <access denied>
 Kernel driver in use: sdhci-pci

04:00.2 SD Host controller [0805]: JMicron Technology Corp. Standard SD Host Controller [197b:2381] (rev 80) (prog-if 01)
 Subsystem: CLEVO/KAPOK Computer Device [1558:4101]
 Flags: fast devsel, IRQ 18
 Memory at f2405000 (32-bit, non-prefetchable) [size=256]
 Capabilities: <access denied>

04:00.3 System peripheral [0880]: JMicron Technology Corp. MS Host Controller [197b:2383] (rev 80)
 Subsystem: CLEVO/KAPOK Computer Device [1558:4101]
 Flags: bus master, fast devsel, latency 0, IRQ 19
 Memory at f2406000 (32-bit, non-prefetchable) [size=256]
 Capabilities: <access denied>
 Kernel driver in use: jmb38x_ms

04:00.5 Ethernet controller [0200]: JMicron Technology Corp. JMC250 PCI Express Gigabit Ethernet Controller [197b:0250] (rev 03)
 Subsystem: CLEVO/KAPOK Computer Device [1558:4101]
 Flags: bus master, fast devsel, latency 0, IRQ 43
 Memory at f2400000 (32-bit, non-prefetchable) [size=16K]
 I/O ports at 3400 [size=128]
 I/O ports at 3000 [size=256]
 Capabilities: <access denied>
 Kernel driver in use: jme

05:00.0 Network controller [0280]: Realtek Semiconductor Co., Ltd. RTL8191SEvB Wireless LAN Controller [10ec:8172] (rev 10)
 Subsystem: Realtek Semiconductor Co., Ltd. RTL8191SEvB Wireless LAN Controller [10ec:8172]
 Flags: bus master, fast devsel, latency 0, IRQ 18
 I/O ports at 4000 [size=256]
 Memory at f2500000 (32-bit, non-prefetchable) [size=16K]
 Capabilities: <access denied>
 Kernel driver in use: rtl8192se

ff:00.0 Host bridge [0600]: Intel Corporation Core Processor QuickPath Architecture Generic Non-core Registers [8086:2c62] (rev 02)
 Subsystem: CLEVO/KAPOK Computer Device [1558:4101]
 Flags: bus master, fast devsel, latency 0

ff:00.1 Host bridge [0600]: Intel Corporation Core Processor QuickPath Architecture System Address Decoder [8086:2d01] (rev 02)
 Subsystem: CLEVO/KAPOK Computer Device [1558:4101]
 Flags: bus master, fast devsel, latency 0

ff:02.0 Host bridge [0600]: Intel Corporation Core Processor QPI Link 0 [8086:2d10] (rev 02)
 Subsystem: CLEVO/KAPOK Computer Device [1558:4101]
 Flags: bus master, fast devsel, latency 0

ff:02.1 Host bridge [0600]: Intel Corporation Core Processor QPI Physical 0 [8086:2d11] (rev 02)
 Subsystem: CLEVO/KAPOK Computer Device [1558:4101]
 Flags: bus master, fast devsel, latency 0

ff:02.2 Host bridge [0600]: Intel Corporation Core Processor Reserved [8086:2d12] (rev 02)
 Subsystem: CLEVO/KAPOK Computer Device [1558:4101]
 Flags: bus master, fast devsel, latency 0

ff:02.3 Host bridge [0600]: Intel Corporation Core Processor Reserved [8086:2d13] (rev 02)
 Subsystem: CLEVO/KAPOK Computer Device [1558:4101]
 Flags: bus master, fast devsel, latency 0



this is a "product page" for Linux on Laptops.