最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

How to demo nano-x

工作和技术 crifan 2893浏览 0评论

do as descripted in :
Introduction to Microwindows Programming
http://www.linuxjournal.com/article/4309

bin/nano-X & sleep 1;bin/world
but error:
KDGKMODE: Invalid argument
Cannot initialise keyboard

so google and find :
——————————————————————————————————–
Nano-X
[/] [trunk/] [src/] [drivers/] [kbd_ttyscan.c] – Rev 4

static int
TTY_Open(KBDDEVICE *pkd)
{
…………
        /* Save previous settings*/
        if (ioctl(fd, KDGKBMODE, &old_kbd_mode) < 0) {
                perror("KDGKMODE");
                goto err;
        }
……….

refer website:
http://svn.neurostechnology.com/filedetails.php?repname=Nano-X&path=%2Ftrunk%2Fsrc%2Fdrivers%2Fkbd_ttyscan.c&rev=4&sc=0
——————————————————————————————————–
and :
——————————————————————————————————–
> [tosa] nano-X
> KDGKMODE: Invalid argument
> Cannot initialise keyboard

Try TTYKBD instead of SCANKBD in the config – I’m not sure if tosa has
all the needed bits to appear as full featured as a desktop tty.

refer website:
http://www.handhelds.org/hypermail/oe/45/4541.html
——————————————————————————————————–
and :
——————————————————————————————————–
Subject: KDGKMODE: Invalid argument
From: Mikhail Ivanov
Date: Fri, 22 Jun 2001 15:24:08 +0400

I have a keyboard problem: when running nano-X I get:

KDGKMODE: Invalid argument

(followed by "unable to initialise keyboard").
SCANKBD is set to Y in config. The system is
Linux in framebuffer mode. If I set NOKBD in config,
the server works fine, with no keyboard.
Any ideas on how to make the keyboard work are
greatly appreciated.

refer website:
http://www.linuxhacker.org/cgi-bin/ezmlm-cgi/5/4974
——————————————————————————————————–

************************************************************************
http://www.koders.com/
************************************************************************
and in this site ,we can find nearly any string in many many files (such .h .c) of many projects
(here ,my project is nano-x).
——————————————————————————————————–
so find KDGKMODE in that site ,and the search result is same as above one:
——————————————————————————————————–
kbd_ttyscan.c
Language: C
Copyright: (c) 2000 Greg Haerr
LOC: 466

static int
TTY_Open(KBDDEVICE *pkd)
{
…………
        /* Save previous settings*/
        if (ioctl(fd, KDGKBMODE, &old_kbd_mode) < 0) {
                perror("KDGKMODE");
                goto err;
        }
……….

refer website:
http://www.koders.com/c/fid96861B94BAAA2C9A3D99D270BD5EEC193414E2CB.aspx
——————————————————————————————————–

——————————————————————————————————–
20:53.27    LWATCDR    anyone here use microwindows?
20:53.45    LWATCDR    I can not seem to get any of the demos to run.
20:53.52    sorphin    cosmicpenguin does 😉
20:54.25    LWATCDR    When I tried to run a nano-x program with the server it told me that it could not init the keyboard.
20:54.47    LWATCDR    I used the x11 config and I am using a USB keyboard but it works for x.
20:54.58    sorphin    CosmicPenguin: sounds like your cue 😉
20:56.22    LWATCDR    I wonder where he is?
20:57.08    sorphin    18 mins idle
20:57.11    prpplague    probably dealing with his boss
20:57.28    sorphin    prpplague: s/dealing with/servicing/
20:57.33    prpplague    lol
20:57.35    LWATCDR    ahh. He is not lagged.
20:59.22    CosmicPenguin    hello
21:00.57    LWATCDR    I am having an issue with Microwindows.
21:01.05    CosmicPenguin    shoot
21:01.35    LWATCDR    I can not get the demos to run. I am using the config.x11 under linux
21:01.40    CosmicPenguin    ok
21:01.44    LWATCDR    i did the make clean; make
21:01.45    CosmicPenguin    what are the symptoms
21:02.05    LWATCDR    when I run the nano-x server it says it can not init the keyboard
21:04.42    LWATCDR    actually it says KDGKMODE invalid argument
21:05.06    LWATCDR    then it says can not initalize the keyboard.
21:05.30    LWATCDR    then the client can not connect.
21:06.31    LWATCDR    I wonder if the got dragged off again.
21:10.44    CosmicPenguin    hold on
21:11.24    LWATCDR    No rush. I am greatful for any help I can get.
21:18.46    CosmicPenguin    Ad you are using config.x11?
21:19.37    CosmicPenguin    Thats an important distiction – if you are using the X11 driver, it should automatically use the same keyboard and mouse as the X11 server.
21:20.28    CosmicPenguin    But if you are building for a framebuffer driver, you need to make sure that 1) you built the right TTY driver, and 2) that you are using the right console for input
21:21.06    LWATCDR    I did cp config.x11 config
21:21.23    LWATCDR    That should set it to use config.x11 correct?
21:23.28    LWATCDR    I am doing a make clean make right now.
21:24.00    CosmicPenguin    the config.x11 requires XWindows to run correctly. Is that what you want?
21:25.35    MonMotha    hum, I wish Intel would actually send those dev guides they said they would
21:26.15    LWATCDR    Yes for now. I have x and kde running on the machine with out any issues.
21:26.28    LWATCDR    This is for testing and getting my feet wet.
21:27.06    CosmicPenguin    Ok. Because you are acting like a X11 client, you should be using the X11 drivers for everything
21:27.16    CosmicPenguin    But it seems that your config is building in the tty driver by accident
21:27.33    LWATCDR    What should I turn off?
21:29.32    LWATCDR    I think I found it. I hate to sound dumb but the make file uses the config file in src and not in src/Configs doesn’t it?
21:30.37    LWATCDR    That was it. I copied the config.x11 to the wrong place. I had it in the Configs dir.
21:30.44    CosmicPenguin    That would do it
21:30.46    LWATCDR    Thank you for your help.
21:30.47    LWATCDR    exit

refer website:
http://purl.rikers.org/%23elinux/20030121.html.gz
——————————————————————————————————–

so we try firstly to set TTYKBD=Y and SCANKBD=N in src/config ,like this :
# keyboard or null kbd driver
TTYKBD                   = Y
SCANKBD                  = N
PIPEKBD                  = N
IPAQKBD                  = N
LIRCKBD                  = N
NOKBD                    = N

then do:
make clean
make

then :
bin/nano-X & sleep 1; bin/world

but except display:
[1] 24822

[1]+ Stopped                 bin/nano-X

then show nothing !

and in the end ,I find ,nano-X and world files is not in /bin ,but in ./bin !!!

so do :
./bin/nano-X & sleep 1; ./bin/world

but still show nothing .

and try :
./bin/nano-X & sleep 1
and display:
[3] 25023

[3]+ Stopped                 ./bin/nano-X

so try:
./bin/nano-X
but error:
Error opening /dev/fb0: No such file or directory. Check kernel config
Cannot initialise screen

also ,wo do sudo ./bin/nano-X,and still above error.

after reading :
——————————————————————————————————–
Configuring the Output Screen Device

Since Microwindows is capable of running on frame buffer systems and within X, a few configuration settings are required to specify options available for each of these screen drivers. If you’re already using a Linux desktop running X, it’s best to build the system first using the X screen driver, then later create a frame buffer version for your embedded device. To configure the X screen driver, set the following options:

X11=Y
SCREEN_WIDTH=640
SCREEN_HEIGHT=480
SCREEN_PIXTYPE=MWPF_TRUECOLOR0888

These options tell Microwindows to run within a virtual 640×480 window on the X desktop and to run programs using an output color model of eights bits each for red, green and blue. By changing these settings, you can control the emulation of a target embedded device on your desktop. For instance, to emulate a 16-bits per pixel display, use SCREEN_PIXTYPE=MWPF_TRUECOLOR565. These MWPF constants are explained in more detail in the src/include/mwtypes.h header file.

Setting up the frame buffer display is a bit more complicated since you have to be sure that your Linux system kernel is compiled for frame buffer support. Set the following options for most frame buffer systems:

X11=N
FRAMEBUFFER=Y
FBVGA=Y
VTSWITCH=Y
PORTRAIT_MODE=N

The FBVGA option compiles in support for a 16-color VGA planar mode screen driver. This option won’t typically be used with embedded systems, however. The VTSWITCH option allows Microwindows to run on the console frame buffer but switch to another virtual console when an Alt-function key is pressed. For some embedded systems, this option must be turned off. Finally, the PORTRAIT_MODE option set to R or L builds a server that will run tilted either right or left, which is suitable for systems like the new Compaq iPAQ PDA.

in
http://www.linuxjournal.com/article/4309
——————————————————————————————————–
so try to edit src/config ,set the X11=Y like this :
——————————————————————————————————–
####################################################################
ifneq ($(ARCH), ELKS)

# X Window screen, mouse and kbd drivers
X11                      = Y

ifeq ($(X11), Y)
# startup screen width, height, (depth for palette mode only)
SCREEN_WIDTH             = 640
SCREEN_HEIGHT            = 480
SCREEN_DEPTH             = 4

# You may want to turn this on for XFree86 4.x or if your backing store
# isn’t functioning properly
USE_EXPOSURE        = Y

else

# framebuffer screen driver (linear and/or vga 4 planes)
# set VTSWITCH to include virtual terminal switch code
# set FBREVERSE to reverse bit orders in 1,2,4 bpp
# set FBVGA=N for all systems without VGA hardware (for MIPS must=N)
FRAMEBUFFER              = Y
FBVGA                    = Y
VTSWITCH                 = Y
FBREVERSE                = N

# set HAVETEXTMODE=Y for systems that can switch between text & graphics.
# On a graphics-only embedded system, such as Osprey and Embedded
# Planet boards, set HAVETEXTMODE=N
HAVETEXTMODE             = Y

# svgalib screen driver
VGALIB                   = N

# direct VGA hardware access screen driver
HWVGA                    = N

####################################################################
——————————————————————————————————–
then redo make clean ,make :

but error:
——————————————————————————————————–
scr_x11.c:15:22: error: X11/Xlib.h: No such file or directory
scr_x11.c:16:23: error: X11/Xutil.h: No such file or directory
scr_x11.c:94: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
scr_x11.c:96: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
…….
scr_x11.c:130: error: expected specifier-qualifier-list before ‘XColor’
scr_x11.c: In function ‘lookup_color’:
scr_x11.c:142: error: ‘XColor’ undeclared (first use in this function)
scr_x11.c:142: error: (Each undeclared identifier is reported only once
……
——————————————————————————————————–
so to find Xlib.h :
sudo find / -name "Xlib.h" -ls
but can’t find and file about Xlib.h,so we guess ,maybe the Ubuntu donnot support X11.
——————————————————————————————————–
so edit the src/config file ,and set X11=N ,like this:
# X Window screen, mouse and kbd drivers
X11                      = N

and after read :
——————————————————————————————————–
http://www.minigui.org/cgi-bin/lb5000/topic.cgi?forum=28&topic=545&show=50
修改你的lilo或者grub的配置文件,加上vga=xxx的启动参数吧,这会用vga方式启动,这样framebuffer才会工作,fb0应该就可以用了,xxx为分辨率,请到网上查参数,试试?

   
在/boot/grub/menu.lst

kernel /rmlinuz-2.z.xx 加上 vga=788 即可
——————————————————————————————————–
so try to set it :
sudo find / -name "grub" -ls
and find the grub :/boot/grub
in that dir,there is a menu.lst file .
edit it.
——————————————————————————————————–
title        Ubuntu, kernel 2.6.20-15-generic
root        (hd0,0)
kernel        /boot/vmlinuz-2.6.20-15-generic root=UUID=b7fa15fe-4b04-44af-8a6e-e1e2686fbbd5 ro quiet splash
initrd        /boot/initrd.img-2.6.20-15-generic
quiet
savedefault
——————————————————————————————————–
after the end of kernel line,we add vga=788 like this:
kernel        /boot/vmlinuz-2.6.20-15-generic root=UUID=b7fa15fe-4b04-44af-8a6e-e1e2686fbbd5 ro quiet splash vga=788
——————————————————————————————————–
after done of above then
restart your system firtly and redo:
make clean
make
——————————————————————————————————–
then error:
——————————————————————————————————–
createfont: (height == 0) found builtin font System (0)
Cannot initialise mouse
——————————————————————————————————–
after reading:

——————————————————————————————————–
12.启动后minicom无法进入命令提示符的问题
目前我们提供的标准套件中,板子加电启动后,在minicom中可以看到启动信息的最后没有进入系统命令
提示符,最后的几行信息如下:
createfont: (height == 0) using builtin font System (0)
createfont: (height == 0) using builtin font System (0)
createfont: (height == 0) using builtin font Helvetica (1)
然后就停在这里不动了.
这是因为我们启动执行microwin的例程malpha,没有加&后台运行符所致,用户只要在minicom里面,等
板子启动完成后,按下ctrl+C,然后回车,就可进入命令提示符界面.或者重做RAMDISK,修改
etc/init.d/rcS,将malpha改为malpha&即可.

in :
http://ssg.ustcsz.edu.cn/~johnnyx/course/hharm.pdf
or:
http://cache.baidu.com/c?word=createfont%3B%3A%2Cheight%2C0%2Cfound%2Cbuiltin%2Cfont%2Csystem&url=http%3A//ssg%2Eustcsz%2Eedu%2Ecn/%7Ejohnnyx/course/hharm%2Epdf&p=c4759a479f8308f70be2977c7f51&user=baidu#baidusnap0
——————————————————————————————————–
so try to do as metion before:
./bin/nano-X & sleep 1
but still error:
——————————————————————————————————–
[3] 12708
Cannot bind to named socket
[3]   Exit 1                  ./bin/nano-X
——————————————————————————————————–
baidu and find:
——————————————————————————————————–
我做了个嵌入系统
内核:2.4.22
vga:vesa   2.0   fb:=800x600x16
图形:microwindows+nona-X
把ldd连接的内容全搞过去了,移植后提示;
"Cannot   bind   to   named   socket   "
难道microwindows+nona-X还捆绑了什么?

自己已经搞清楚了!   收贴!
One   thing   that   will   cause   this   error   error   is   the   inability   to   create   (or   delete)   the   named   socket   "/tmp/.nano-X".   You   may   have   problems   with   this   if   one   user   creates   the   socket   and   then   nano-X   subsequently   crashes   if   you   try   to   run   nano-X   from   another   userid   you   will   get   this   error.   
  
Delete   the   named   socket   "/tmp/.nano-X"   if   it   exists,   otherwise   verify   that   the   userid   that   is   attempting   to   run   nano-X   has   write   permissions   to   the   /tmp   directory.

in:
Cannot bind to named socket 不知道缺少了什么?
http://topic.csdn.net/t/20031014/18/2355292.html
——————————————————————————————————–
here ,I don’t konw how to delete that socket,so restart the system.

after starting the new system,then do :
sudo ./bin/nano-X & sleep 1; ./bin/world
——————————————————————————————————–
it show:
[1]+ Stopped                 sudo ./bin/nano-X
nxclient: retry connect attempt 1

google and baidu ,but no help infomation for this .
Finnally ,I found the source about the " nxclient: retry connect attempt " in src/nanox/client.c:

——————————————————————————————————–
/**
* Open a connection to the graphics server.
*
* @return the fd of the connection to the server or -1 on failure
*
* @ingroup nanox_general
*/
int
GrOpen(void)
{
    size_t         size;
    nxOpenReq    req;
    int        tries;
    int        ret = 0;
#if ADDR_FAM == AF_NANO
    struct sockaddr_na name;
#elif ADDR_FAM == AF_INET
    struct sockaddr_in name;
    struct hostent *he;
    /* allow specification of remote nano-X server address*/
    char *sockaddr = getenv("NXDISPLAY");
    if (!sockaddr)
        sockaddr = "127.0.0.1";        /* loopback address*/
#elif ADDR_FAM == AF_UNIX
    struct sockaddr_un name;
    /* allow override of named UNIX socket (default /tmp/.nano-X)*/
    char *sockname = getenv("NXDISPLAY");
    if (!sockname)
        sockname = GR_NAMED_SOCKET;
#else
#error "ADDR_FAM not defined to AF_NANO, AF_INET or AF_UNIX"
#endif
    ACCESS_PER_THREAD_DATA()
   
    /* check already open*/
    if (nxSocket >= 0)
            return nxSocket;

    /* try to get socket*/
    if ((nxSocket = socket(ADDR_FAM, SOCK_STREAM, 0)) == -1)
        return -1;

    /* initialize global critical section lock*/
    LOCK_INIT(&nxGlobalLock);

#if ADDR_FAM == AF_NANO
    name.sun_family = AF_NANO;
    name.sun_no = GR_ELKS_SOCKET;        /* AF_NANO socket 79*/
    size = sizeof(struct sockaddr_na);
#elif ADDR_FAM == AF_INET
    name.sin_family = AF_INET;
    name.sin_port = htons(GR_NUM_SOCKET);    /* AF_INET socket 6600*/
    if (!(he = gethostbyname(sockaddr))) {
        EPRINTF("nxclient: Can’t resolve address for server %sn", sockaddr);
        close(nxSocket);
        nxSocket = -1;
        return -1;
    }
    name.sin_addr = *(struct in_addr *)he->h_addr_list[0];
    size = sizeof(struct sockaddr_in);
#elif ADDR_FAM == AF_UNIX
    name.sun_family = AF_UNIX;
    strcpy(name.sun_path, sockname);
    size = (offsetof(struct sockaddr_un, sun_path) +
        strlen(name.sun_path) + 1);
#endif

    /*
    * Try to open the connection ten times,
    * waiting 0.1 or 2.0 seconds between attempts.
    */
    for (tries=1; tries<=10; ++tries) {
        struct timespec req;

        ret = connect(nxSocket, (struct sockaddr *) &name, size);
        if (ret >= 0)
            break;
#if ADDR_FAM == AF_INET
        req.tv_sec = 0;
        req.tv_nsec = 100000000L;
#else
        req.tv_sec = 2;
        req.tv_nsec = 0;
#endif
        nanosleep(&req, NULL);
        EPRINTF("nxclient: retry connect attempt %dn", tries);
    }
    if (ret == -1) {
        close(nxSocket);
        nxSocket = -1;
        return -1;
    }

    setbuf(stdout, NULL);
    setbuf(stderr, NULL);

    /*
    * By Performing the ‘GrOpen’ without allocating a buffer, just
    * shuffeling the struct over the wire, we can postpone the
    * allocation of the client size command buffer, which will never be
    * allocated if the first command after GrOpen() is
    * GrReqShmCmds() which allocates a replacement shared memory
    * segment.
    * So: Calling GrReqShmCmds() right after GrOpen will prevent the
    * traditional command queue buffer from being allocated from
    * the process heap – and only the shared memory segment is
    * allocated.
    */
    req.reqType = GrNumOpen;
    req.hilength = 0;
    req.length = sizeof(req);
    /* associate the process ID with the client*/
    req.pid = getpid();

    nxWriteSocket((char *)&req,sizeof(req));
    return nxSocket;
}

——————————————————————————————————–
after reading the file config and client.c ,I add some debug info into client.c ,to find wether the
ADDR_FAM is defined as AF_NANO or AF_INET or AF_UNIX.
then we can konw which the struct name is sockaddr_na or sockaddr_in or sockaddr_un

run ,and the output is :
——————————————————————————————————–
crifan@crifan-desktop:~/download/microwindows-0.90/src$ sudo ./bin/nano-X & sleep 1; ./bin/world
[1] 11718
Password:

[1]+ Stopped                 sudo ./bin/nano-X
now,nxSocket is 3
now,size     is 15
now ,the ret is -1
req.tv_sec is 2
req.tv_nsec is 0
nxclient: retry connect attempt 1
now,nxSocket is 3
now,size     is 15
now ,the ret is -1
req.tv_sec is 2
req.tv_nsec is 0
nxclient: retry connect attempt 2
now,nxSocket is 3
now,size     is 15
now ,the ret is -1

——————————————————————————————————–

——————————————————————————————————–

——————————————————————————————————–

——————————————————————————————————–

转载请注明:在路上 » How to demo nano-x

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
79 queries in 0.202 seconds, using 22.23MB memory