Sunday, October 3, 2010

Genius G-Pen 560 under Ubuntu 10.04

1) add ppa and install wizardpen driver (xorg) from it
2) edit /usr/lib/X11/xorg.conf.d/70-wizardpen.conf to the following:

Section "InputClass"
Identifier "wizardpen"
MatchIsTablet "on"
MatchDevicePath "/dev/input/event*"
# MatchVendor "UC-LOGIC|KYE Systems|Ace Cad"
Driver "wizardpen"
Option "TopZ" "32"
Option "BottomZ" "1023"
Option "TopX" "185"
Option "TopY" "372"
Option "BottomX" "11811"
Option "BottomY" "8793"

EndSection
Section "InputClass"
Identifier "wizardpen ignore mouse dev"
MatchIsTablet "on"
MatchDevicePath "/dev/input/mouse*"
# MatchVendor "UC-LOGIC|KYE Systems|Ace Cad"
Driver ""
EndSection

3) reboot

Sunday, December 27, 2009

link once (simulating c++ template code in pure c with GCC extensions)

The following definition will be merged in all compiled object files, i.e. the first function implementation will be linked into the produced binary and the following copies rejected.


__attribute__((section(".gnu.linkonce.c"))) int commonFunc(int a, int b) {
return a-b;
}

Simmulating "exceptions" in pure C

 #include <stdio.h>  
#include <setjmp.h>
typedef struct ExcHandlerDesc_ {
struct ExcHandlerDesc_ * prev;
jmp_buf jmpBuf;
int handled; // 0 = did not handle the exception
int excId; // the id of unhandled exception for rethrow
} ExcHandlerDesc;
static ExcHandlerDesc * xroot;
#define XR_CODE_BLOCK 0
#define XR_FINALLY_BLOCK -1
// starting exception id
#define XR_EXC_ID 2
//#define X_TRY(exchd_) addXHandler(exchd_); switch (setjmp(exchd_.jmpBuf)) {
//#define X_END(exchd_) }; removeXHandler(exchd_);
////////
void throwIt(int v) {
if (xroot == 0) {
printf("Unhandled exception %i !!!\n", v);
exit(1);
}
xroot->excId = v;
//xroot->handled = 1;
longjmp(xroot->jmpBuf, v);
}
void addXHandler(ExcHandlerDesc*d) {
d->handled = 1;
d->prev = xroot;
xroot = d;
}
void removeXHandler() {
if (xroot) {
xroot = xroot->prev;
}
}
////////
void funcWithExc() {
// throw
throwIt(2);
}
void func1() {
funcWithExc();
}
void func0()
{
int a;
// try
ExcHandlerDesc xhd;
addXHandler(&xhd);
a = setjmp(xhd.jmpBuf);
if ((a != XR_CODE_BLOCK) && (xroot == &xhd)) {
removeXHandler();
}
switch(a) {
case XR_CODE_BLOCK:
func1();
break;
case XR_FINALLY_BLOCK:
// do cleanup
if (!xhd.handled)
throwIt(xhd.excId);
break;
case XR_EXC_ID:
// handle it
printf("Caught %i !\n", xhd.excId);
// handler is removed and rethrow here is allowed
throwIt(2);
break;
default:
// unhandled!
xhd.handled = 0;
break;
}
// cleanup
if (a != XR_FINALLY_BLOCK)
longjmp(xhd.jmpBuf, XR_FINALLY_BLOCK);
/// end exception handling
}
int main() {
func0();
return 0;
}

Sunday, May 17, 2009

Ubuntu 9.04 on HP Compaq 6510b

Core2Duo T7250, 2GB, intel 965

LiveCD runs fine, all hardware works.
After installation everything works just fine except compiz -- it doesn't run, although 3D games like TuxRacer, Chromium etc. run smooth.

Friday, March 20, 2009

Beholder BeholdTV 507 Lirc settings

/etc/lircd.conf

begin remote
name Beholder
bits 16
eps 30
aeps 100
one 0 0
zero 0 0
pre_data_bits 16
pre_data 0x8001
gap 132757
toggle_bit 0

begin codes
1 0x0002
2 0x0003
3 0x0004
4 0x0005
5 0x0006
6 0x0007
7 0x0008
8 0x0009
9 0x000A
0 0x000B
UP 0x0067
LEFT 0x0069
RIGHT 0x006A
DOWN 0x006C
MUTE 0x0071
VOL- 0x0072
VOL+ 0x0073
POWER 0x0074
RECALL 0x0081
MENU 0x008B
SLEEP 0x008E
OK 0x0160
INFO 0x0166
MODE 0x0175
TV/AV 0x0179
FUNCTION 0x0181
AUDIO 0x0188
CHANNEL+ 0x0192
CHANNEL- 0x0193
DIGITS 0x019D
end codes
end remote

Saturday, November 29, 2008

Genius G-Pen 560 Tablet on Ubuntu Linux 8.10 Intrepid

This tablet is detected as "Aiptek" and successfully managed by aiptek kernel driver. However, for X11 you'll need a recent wizardpen_drv (0.6.x)

1) Find in "wizardpen.c" lines with case BTN_LEFT etc. and add BTN_STYLUS, BTN_STYLUS2 and BTN_TOUCH where appropriate. Compile and install as described in the README.

2) Do not add tablet description to xorg.conf, instead comment the mouse definition in the layout section of the config and add file "99-x11-wizardpen.fdi" to "/etc/hal/fdi/policy"

---

<?xml version="1.0" encoding="ISO-8859-1" ?>
<deviceinfo version="0.2">
<device>
<!-- This MUST match with the name of your tablet -->
<match key="info.product" contains="Aiptek">
<merge key="input.x11_driver" type="string">wizardpen</merge>

<!-- <merge key="input.x11_driver" type="string">wacom</merge>
<merge key="input.x11_options.Type" type="string">stylus</merge> -->



<merge key="input.x11_options.SendCoreEvents" type="string">true</merge>
<merge key="input.x11_options.TopX" type="string">185</merge>
<merge key="input.x11_options.TopY" type="string">372</merge>
<merge key="input.x11_options.BottomX" type="string">11811</merge>
<merge key="input.x11_options.BottomY" type="string">8793</merge>
<merge key="input.x11_options.MaxX" type="string">11811</merge>
<merge key="input.x11_options.MaxY" type="string">8793</merge>


<merge key="input.x11_options.TopZ" type="string">32</merge>
<merge key="input.x11_options.MaxZ" type="string">1023</merge>
<merge key="input.x11_options.BottomZ" type="string">1023</merge>


</match>
</device>
</deviceinfo>
---

Beholder TV tuner 507 on Ubuntu Linux 8.10 Intrepid

Create new file, e.g. "beholder.conf" in /etc/modprobe.d/
with the following text:

-----

options tuner secam=d
options tda9887 secam=d
options saa7134 tuner=38 card=67 gbuffers=4
alias char-major-89-* i2c-dev
options i2c-algo-bit bit_test=1

----

Now reboot.