does anyone use the IODATA CF-XGA card successfully under pdaXrom 1.1.0beta3?
Anyone willing to help to make it work?
I tried with different versions of the cfxga-mirror tool available on the Internet but to no avail.
The "cfxga-mirror" tool which is shipped with pdaXrom 1.1.0beta3 and installed under /usr/bin generates a disturbed
image on the external monitor (rotated by 90 degrees, ghosted four times and interlaced).
I have not found the sources for that. Does anyone have them?
So I downloaded the "cfxgamirror" and "cfxgamirror2" sources, the first one from trisoft, the other one from a Japanese page.
cfxgamirror needed a little change in order to generate a good image on the monitor. Otherwise it generated also a disturbed image, but different than
"cfxga-mirror".
cfxgamirror2 did it fine without the change.
BUT: Both of these versions crash the Zaurus after some seconds if used under X.
If used under console without X (i.e. directly after booting) they work fine.
The pre-installed "cfxga-mirror" does not crash, at least not as fast as the others.
Also, if I start them under console without X, then terminate them, and then want to start X, I get this error and X doesn't start until I reboot:
CODE
#startx
Loading /etc/sysconfig/keyboard/kernel.map
_XSERVTransSocketOpenCOTSServer: Unable to open socket for inet6
_XSERVTransOpen: transport open failed for inet6/zaurus:0
_XSERVTransMakeAllCOTSServerListeners: failed to open listener for inet6
XIO: fatal IO error 104 (Conection reset by peer) on X server ":0.0"
after 0 requests (0 known processed) with 0 events remaining.
Loading /etc/sysconfig/keyboard/kernel.map
_XSERVTransSocketOpenCOTSServer: Unable to open socket for inet6
_XSERVTransOpen: transport open failed for inet6/zaurus:0
_XSERVTransMakeAllCOTSServerListeners: failed to open listener for inet6
XIO: fatal IO error 104 (Conection reset by peer) on X server ":0.0"
after 0 requests (0 known processed) with 0 events remaining.
Below is the source code of cfxgamirror2.c which causes that problems.
Does anyone have a clue why:
1. the tool crashes the Zaurus
2. ...only when in X
3. startx cannot be executed after the tool ran under console
(even ejecting the card and/or unloading memory_cs.o does not help for startx)
4. how I can make this card work well under pdaXrom?
Currently I am trying to track down the position in the source where the zaurus crashes using printf commands.
Will update this thread on each result.
Any help or hint greatly appreciated!
Thanks a lot!
daniel
here comes cfxgamirror2.c:
CODE
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <ctype.h>
#include <fcntl.h>
#include "cfxga.h"
#define SCREEN_WIDTH 640
#define SCREEN_HEIGHT 480
int main(int argc, char *argv[])
{
unsigned short *scrnbuf, *sb2;
unsigned long rez;
int fd, fbfd, center=0;
struct cfxgaset desc = { 0, 0, 640, 480, 16, 1280, NULL };
struct cfxgaget info;
fd = open("/dev/cfxga0a", O_RDWR);
if(fd < 0)
{
printf("No CFXGA card\n");
return -1;
}
if(argc == 1 || argc>3 ||
(!isdigit(argv[1][0])&&!isdigit(argv[argc-1][0])))
{
int i;
printf("usage: cfxgamirror [-c] <mode>\n Available modes:\n");
// display data for all modes
ioctl(fd, CFXGANUMMODES, &rez);
for(i = 0; i < rez; i++)
{
info.mode = i;
ioctl(fd, CFXGAGETMODE, &info);
printf("%2ld: W=%ld H=%ld vf=%-2ld d=%ld hf=%ld vid=%02lx\n", info.mode, info.width, info.height, info.vfreq,
info.depth, info.hfreq, info.appl);
}
printf("must assign mode number\n");
printf("-c : display to center and no scaling\n");
close(fd);
return 1;
}
if (argv[1][0]=='-'&&argv[1][1]=='c')
center = 1;
rez = atoi(argv[argc-1]);
// get mode stats
info.mode = rez;
ioctl(fd, CFXGAGETMODE, &info);
// display mode specs
printf("%2ld: W=%ld H=%ld vf=%-2ld d=%ld hf=%ld vid=%02lx\n", info.mode, info.width, info.height, info.vfreq, info.depth,
info.hfreq, info.appl);
if (center==0)
{
desc.height = info.height;
desc.width = info.width;
}
else
{
desc.left = (info.width - desc.width) / 2;
desc.top = (info.height - desc.height) / 2;
desc.height = SCREEN_HEIGHT;
desc.width = SCREEN_WIDTH;
}
desc.stride = desc.width*2;
// set mode
ioctl(fd, CFXGASETMODE, &rez);
// clear screen
ioctl(fd, CFXGACLEAR, NULL);
// map screen buffer
fbfd = open("/dev/fb0", O_RDONLY); // I'm not sure when I can close this
sb2 = mmap(0, SCREEN_WIDTH * SCREEN_HEIGHT * 2, PROT_READ, MAP_PRIVATE, fbfd, 0);
// close(fbfd); /* comment by daniel3000: I tried this here, but it does not make a difference at all. */
// a normal malloc or global may work, but to be safe...
scrnbuf = mmap(0, desc.width * desc.height * 2, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
desc.image = scrnbuf;
// update the image a little slower than every second
for(;;)
{
static int sum;
int i,j,x,y,dx,dy,cx,cy,cksum;
unsigned short *dst,*src;
dx = desc.width - SCREEN_WIDTH;
dy = desc.height - SCREEN_HEIGHT;
cksum = 0;
dst = scrnbuf;
y = SCREEN_HEIGHT-1;
for(cy=i=0;i<desc.height;i++,y--)
{
src = sb2+y;
for(x=cx=j=0;j<desc.width;j++,dst++)
{
cksum+=(*dst=src[x]);
cx += dx;
if (cx>=desc.width)
{
cx -= desc.width;
x -= SCREEN_HEIGHT;
}
x += SCREEN_HEIGHT;
}
cy += dy;
if (cy>=desc.height)
{
cy-=desc.height;
y++;
}
}
// send to VGA chip
if (sum!=cksum)
{
ioctl(fd, CFXGAWRITERECT, &desc);
sum = cksum;
}
sleep(1);
}
}
#include <unistd.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <ctype.h>
#include <fcntl.h>
#include "cfxga.h"
#define SCREEN_WIDTH 640
#define SCREEN_HEIGHT 480
int main(int argc, char *argv[])
{
unsigned short *scrnbuf, *sb2;
unsigned long rez;
int fd, fbfd, center=0;
struct cfxgaset desc = { 0, 0, 640, 480, 16, 1280, NULL };
struct cfxgaget info;
fd = open("/dev/cfxga0a", O_RDWR);
if(fd < 0)
{
printf("No CFXGA card\n");
return -1;
}
if(argc == 1 || argc>3 ||
(!isdigit(argv[1][0])&&!isdigit(argv[argc-1][0])))
{
int i;
printf("usage: cfxgamirror [-c] <mode>\n Available modes:\n");
// display data for all modes
ioctl(fd, CFXGANUMMODES, &rez);
for(i = 0; i < rez; i++)
{
info.mode = i;
ioctl(fd, CFXGAGETMODE, &info);
printf("%2ld: W=%ld H=%ld vf=%-2ld d=%ld hf=%ld vid=%02lx\n", info.mode, info.width, info.height, info.vfreq,
info.depth, info.hfreq, info.appl);
}
printf("must assign mode number\n");
printf("-c : display to center and no scaling\n");
close(fd);
return 1;
}
if (argv[1][0]=='-'&&argv[1][1]=='c')
center = 1;
rez = atoi(argv[argc-1]);
// get mode stats
info.mode = rez;
ioctl(fd, CFXGAGETMODE, &info);
// display mode specs
printf("%2ld: W=%ld H=%ld vf=%-2ld d=%ld hf=%ld vid=%02lx\n", info.mode, info.width, info.height, info.vfreq, info.depth,
info.hfreq, info.appl);
if (center==0)
{
desc.height = info.height;
desc.width = info.width;
}
else
{
desc.left = (info.width - desc.width) / 2;
desc.top = (info.height - desc.height) / 2;
desc.height = SCREEN_HEIGHT;
desc.width = SCREEN_WIDTH;
}
desc.stride = desc.width*2;
// set mode
ioctl(fd, CFXGASETMODE, &rez);
// clear screen
ioctl(fd, CFXGACLEAR, NULL);
// map screen buffer
fbfd = open("/dev/fb0", O_RDONLY); // I'm not sure when I can close this
sb2 = mmap(0, SCREEN_WIDTH * SCREEN_HEIGHT * 2, PROT_READ, MAP_PRIVATE, fbfd, 0);
// close(fbfd); /* comment by daniel3000: I tried this here, but it does not make a difference at all. */
// a normal malloc or global may work, but to be safe...
scrnbuf = mmap(0, desc.width * desc.height * 2, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
desc.image = scrnbuf;
// update the image a little slower than every second
for(;;)
{
static int sum;
int i,j,x,y,dx,dy,cx,cy,cksum;
unsigned short *dst,*src;
dx = desc.width - SCREEN_WIDTH;
dy = desc.height - SCREEN_HEIGHT;
cksum = 0;
dst = scrnbuf;
y = SCREEN_HEIGHT-1;
for(cy=i=0;i<desc.height;i++,y--)
{
src = sb2+y;
for(x=cx=j=0;j<desc.width;j++,dst++)
{
cksum+=(*dst=src[x]);
cx += dx;
if (cx>=desc.width)
{
cx -= desc.width;
x -= SCREEN_HEIGHT;
}
x += SCREEN_HEIGHT;
}
cy += dy;
if (cy>=desc.height)
{
cy-=desc.height;
y++;
}
}
// send to VGA chip
if (sum!=cksum)
{
ioctl(fd, CFXGAWRITERECT, &desc);
sum = cksum;
}
sleep(1);
}
}
