#include <stdio.h>/* 96BoardsGPIO header file */#include <gpio.h>/* Just make the pin numbers easier to remember */int main(int argc, char * argv[])
{
int x;
unsignedint gpio_a = gpio_id("GPIO_A");
/* * GPIO_A can also be looked up with: * gpio_a = gpio_by_letter('A'); * gpio_a = gpio_by_pin(23); */// Open the GPIO for use. Do so by pin number on the// Low Speed Expansion Connector.if (!gpio_open(gpio_a, "out")) {
for (x=0; x<10; x++) {
digitalWrite(gpio_a, HIGH);
usleep(500000);
digitalWrite(gpio_a, LOW);
usleep(500000);
}
} else {
fprintf(stderr, "Unable to open GPIO_A\n");
return -1;
}
return0;
}
$ sudo apt-chache search x11vnc
ssvnc - Enhanced TightVNC viewer with SSL/SSH tunnel helper
x11vnc - VNC server to allow remote access to an existing X session
x11vnc-data - data files for x11vnc
$ x11vnc -storepasswd
Enter VNC password:
Verify password:
Write password to /home/linaro/.vnc/passwd? [y]/n
Password written to: /home/linaro/.vnc/passwd
$ x11vnc -usepw03/06/201709:46:46-usepw: found /home/linaro/.vnc/passwd
03/06/201709:46:46 x11vnc version: 0.9.13 lastmod: 2011-08-10 pid: 299803/06/201709:46:46 XOpenDisplay("") failed.
03/06/201709:46:46 Trying again with XAUTHLOCALHOSTNAME=localhost ...
03/06/201709:46:4603/06/201709:46:46 *** XOpenDisplay failed. No -display or DISPLAY.
03/06/201709:46:46 *** Trying ":0"in4 seconds. Press Ctrl-C to abort.
03/06/201709:46:46 *** 123403/06/201709:46:50 *** XOpenDisplay of ":0" successful.
03/06/201709:46:5003/06/201709:46:50 Using X display :003/06/201709:46:50 rootwin: 0x205 reswin: 0x2200001 dpy: 0xe4366350
03/06/201709:46:5003/06/201709:46:50------------------ USEFUL INFORMATION ------------------03/06/201709:46:50 X DAMAGE available on display, using it for polling hints.
03/06/201709:46:50 To disable this behavior use: '-noxdamage'03/06/201709:46:5003/06/201709:46:50 Most compositing window managers like 'compiz' or 'beryl'03/06/201709:46:50 cause X DAMAGE to fail, and so you may not see any screen
03/06/201709:46:50 updates via VNC. Either disable 'compiz'(recommended) or
03/06/201709:46:50 supply the x11vnc '-noxdamage'command line option.
03/06/201709:46:5003/06/201709:46:50 Wireframing: -wireframe mode is in effect for window moves.
03/06/201709:46:50 If this yields undesired behavior (poor response, painting
03/06/201709:46:50 errors, etc) it may be disabled:
03/06/201709:46:50 - use '-nowf' to disable wireframing completely.
03/06/201709:46:50 - use '-nowcr' to disable the Copy Rectangle after the
03/06/201709:46:50 moved window is released in the new position.
03/06/201709:46:50 Also see the -help entry for tuning parameters.
03/06/201709:46:50 You can press 3 Alt_L's (Left "Alt" key) in a row to 03/06/2017 09:46:50 repaint the screen, also see the -fixscreen option for03/06/2017 09:46:50 periodic repaints.03/06/2017 09:46:50 03/06/2017 09:46:50 XFIXES available on display, resetting cursor mode03/06/2017 09:46:50 to: '-cursor most'.03/06/2017 09:46:50 to disable this behavior use: '-cursor arrow'03/06/2017 09:46:50 or '-noxfixes'.03/06/2017 09:46:50 using XFIXES for cursor drawing.03/06/2017 09:46:50 GrabServer control via XTEST.03/06/2017 09:46:50 03/06/2017 09:46:50 Scroll Detection: -scrollcopyrect mode is in effect to03/06/2017 09:46:50 use RECORD extension to try to detect scrolling windows03/06/2017 09:46:50 (induced by either user keystroke or mouse input).03/06/2017 09:46:50 If this yields undesired behavior (poor response, painting03/06/2017 09:46:50 errors, etc) it may be disabled via: '-noscr'03/06/2017 09:46:50 Also see the -help entry for tuning parameters.03/06/2017 09:46:50 You can press 3 Alt_L's (Left "Alt" key)in a row to
03/06/201709:46:50 repaint the screen, also see the -fixscreen option for03/06/201709:46:50 periodic repaints.
03/06/201709:46:5003/06/201709:46:50 XKEYBOARD: number of keysyms per keycode 10 is greater
03/06/201709:46:50 than 4 and 100 keysyms are mapped above 4.
03/06/201709:46:50 Automatically switching to -xkb mode.
03/06/201709:46:50 If this makes the key mapping worse you can
03/06/201709:46:50 disable it with the "-noxkb" option.
03/06/201709:46:50 Also, remember "-remap DEAD"for accenting characters.
03/06/201709:46:5003/06/201709:46:50 X FBPM extension not supported.
03/06/201709:46:50 X display is capable of DPMS.
03/06/201709:46:50--------------------------------------------------------03/06/201709:46:5003/06/201709:46:50 Default visual ID: 0x21
03/06/201709:46:50 Read initial data from X display into framebuffer.
03/06/201709:46:50 initialize_screen: fb_depth/fb_bpp/fb_Bpl 24/32/409603/06/201709:46:5003/06/201709:46:50 X display :0 is 32bpp depth=24true color
03/06/201709:46:5003/06/201709:46:50 Autoprobing TCP port
03/06/201709:46:50 Autoprobing selected TCP port 590003/06/201709:46:50 Autoprobing TCP6 port
03/06/201709:46:50 Autoprobing selected TCP6 port 590003/06/201709:46:50 listen6: bind: Address already in use
03/06/201709:46:50 Not listening on IPv6 interface.
03/06/201709:46:50 fb read rate: 91 MB/sec
03/06/201709:46:50 fast read: reset -wait ms to: 1003/06/201709:46:50 fast read: reset -defer ms to: 1003/06/201709:46:50 The X server says there are 16 mouse buttons.
03/06/201709:46:50 screen setup finished.
03/06/201709:46:50
The VNC desktop is: linaro-alip:0PORT=5900
******************************************************************************
Have you tried the x11vnc '-ncache' VNC client-side pixel caching feature yet?
The scheme stores pixel data offscreen on the VNC viewer side for faster
retrieval. It should work with any VNC viewer. Try it by running:
x11vnc -ncache10 ...
One can also add -ncache_crfor smooth 'copyrect' window motion.
More info: http://www.karlrunge.com/x11vnc/faq.html#faq-client-caching
$ git clone https://github.com/96boards/96BoardsGPIO.git
$ cd 96BoardsGPIO
$ ./autogen.sh
$ ./configure
$ make
$ sudo make install
$ sudo ldconfig
makeを実行すると以下のようにErrorが発生してしまいます。
$ make
Making all in lib
make[1]: Entering directory '/home/linaro/96BoardsGPIO/lib'
/bin/bash ../libtool --tag=CC--mode=compile gcc -DPACKAGE_NAME=\"96BoardsGPIO\"-DPACKAGE_TARNAME=\"96boardsgpio\"-DPACKAGE_VERSION=\"0.1\"-DPACKAGE_STRING=\"96BoardsGPIO\ 0.1\"-DPACKAGE_BUGREPORT=\"\"-DPACKAGE_URL=\"\"-DPACKAGE=\"96boardsgpio\"-DVERSION=\"0.1\"-DSTDC_HEADERS=1-DHAVE_SYS_TYPES_H=1-DHAVE_SYS_STAT_H=1-DHAVE_STDLIB_H=1-DHAVE_STRING_H=1-DHAVE_MEMORY_H=1-DHAVE_STRINGS_H=1-DHAVE_INTTYPES_H=1-DHAVE_STDINT_H=1-DHAVE_UNISTD_H=1-DHAVE_DLFCN_H=1-DLT_OBJDIR=\".libs/\"-I. -I../lib -g-O2-MT lib96BoardsGPIO_la-gpio.lo -MD-MP-MF .deps/lib96BoardsGPIO_la-gpio.Tpo -c-o lib96BoardsGPIO_la-gpio.lo `test -f 'gpio.c' || echo'./'`gpio.c
libtool: compile: gcc -DPACKAGE_NAME=\"96BoardsGPIO\"-DPACKAGE_TARNAME=\"96boardsgpio\"-DPACKAGE_VERSION=\"0.1\""-DPACKAGE_STRING=\"96BoardsGPIO 0.1\""-DPACKAGE_BUGREPORT=\"\"-DPACKAGE_URL=\"\"-DPACKAGE=\"96boardsgpio\"-DVERSION=\"0.1\"-DSTDC_HEADERS=1-DHAVE_SYS_TYPES_H=1-DHAVE_SYS_STAT_H=1-DHAVE_STDLIB_H=1-DHAVE_STRING_H=1-DHAVE_MEMORY_H=1-DHAVE_STRINGS_H=1-DHAVE_INTTYPES_H=1-DHAVE_STDINT_H=1-DHAVE_UNISTD_H=1-DHAVE_DLFCN_H=1-DLT_OBJDIR=\".libs/\"-I. -I../lib -g-O2-MT lib96BoardsGPIO_la-gpio.lo -MD-MP-MF .deps/lib96BoardsGPIO_la-gpio.Tpo -c gpio.c -fPIC-DPIC-o .libs/lib96BoardsGPIO_la-gpio.o
gpio.c: In function ‘gpio_id’:
gpio.c:63:17: warning: implicit declaration of function ‘strdup’ [-Wimplicit-function-declaration]
char *fixed = strdup(pin_name);
^~~~~~
gpio.c:63:17: warning: incompatible implicit declaration of built-in function strdup’
gpio.c: In function ‘gpio_open’:
gpio.c:98:41: error: ‘LS_SHARED’ undeclared (first use in this function)
gpio *g = libsoc_gpio_request(gpio_id, LS_SHARED);
^~~~~~~~~
gpio.c:98:41: note: each undeclared identifier is reported only once for each function it appears in
gpio.c:101:7: warning: implicit declaration of function ‘strcmp’ [-Wimplicit-function-declaration]if (!strcmp(direction, "in"))
^~~~~~
Makefile:459: recipe for target 'lib96BoardsGPIO_la-gpio.lo' failed
make[1]: *** [lib96BoardsGPIO_la-gpio.lo] Error 1
make[1]: Leaving directory '/home/linaro/96BoardsGPIO/lib'
Makefile:459: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1
warningは目を瞑るとして、
gpio.c:98:41: error: ‘LS_SHARED’ undeclared (first use in this function)
gpio *g = libsoc_gpio_request(gpio_id, LS_SHARED);
^~~~~~~~~
gpio.c:98:41: note: each undeclared identifier is reported only once for each function it appears in
First, check if your distro packages libsoc. If it does it is easiest to install your distros version of libsoc through it’s provided package manager. Depending on your distro this may be apt-get, yum, pacman, etc. Consult your distro documentation for more info
Linux linaro-alip 4.9.27-linaro-lt-qcom #1 SMP PREEMPT Wed May 10 19:59:33 UTC 2017 aarch64
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Wed May 2419:26:422017 from 192.168.0.7
ERROR: Unable to find libsoc_gpio.conf
cat: /usr/local/etc/libsoc_gpio.conf: No such file or directory
declare-x HOME="/home/linaro"declare-x JAVA_TOOL_OPTIONS="-Dgnu.io.rxtx.SerialPorts=/dev/tty96B0"declare-x LANG="C.UTF-8"declare-x LOGNAME="linaro"declare-x MAIL="/var/mail/linaro"declare-x MONITOR_PORT="/dev/tty96B0"declare-x OLDPWDdeclare-x PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"declare-x PWD="/home/linaro"declare-x SHELL="/bin/bash"declare-x SHLVL="1"declare-x SSH_CLIENT="192.168.0.7 7154 22"declare-x SSH_CONNECTION="192.168.0.7 7154 192.168.0.8 22"declare-x SSH_TTY="/dev/pts/0"declare-x TERM="xterm"declare-x USER="linaro"declare-x XDG_RUNTIME_DIR="/run/user/1000"declare-x XDG_SESSION_ID="5"
linaro@linaro-alip:~$
エラーメッセージを確認するとERROR: Unable to find libsoc_gpio.confというエラーが発生しています。libsocの設定ファイルがみあたらないようです。ソースからインストールした時には発生しなようですが、パッケージでのインストールでは発生してしまっているようです。