博文

树莓派SPI连接TFT屏幕

图片
HDMI连接和树莓派专用连接的接口的屏幕都太贵了,为了节约成本,现在国内大多数还是TFT屏幕。 树莓派可以激活SPI接口,通过代码驱动TFT屏幕的显示。这样利用树莓派zero 打造小型的游戏平台可以大大节约成本。淘宝网上的TFT屏幕很便宜,但是一定要记得别买错了,一定要看说明需要支持SPI接口的才行。各种屏幕的驱动也不一样,国内多半是fb_ili9431的驱动。购买之前先看仔细各种参数。 https://github.com/notro/fbtft/wiki/fbtft_device   https://github.com/notro/fbtft/wiki/LCD-Modules   FBTFT驱动支持列表 比如这种: 1.按照如下图的连接线连接。 2. 先激活树莓派配置 sudo raspi-config 找到Interfacing Options 然后找到P4 SPI然后 enable SPI interface 3. 更新后重启,一定要看到更新成功,如果出现文件错误,可以尝试参考我前面的文章更换镜像地址后重新尝试。 sudo rpi-update sudo reboot 4.执行以下命令就可以发现TFT屏幕可以显示了: 执行命令 sudo modprobe fbtft_device name=rpi-display gpios=reset:25,dc:24,led:18 rotate=90 fps=50 speed=65000000 或者执行  sudo modprobe fbtft_device custom name=fb_ili9431 buswidth=8 gpios=reset:25,dc:24,led:18 rotate=90 fps=50 speed=65000000 参考文献: https://www.raspberrypi.org/forums/viewtopic.php?t=157618 执行完毕后,可以查看日志,日志不能有错误: dmesg 1 2 3 4 5 6 7 8 9 10 11 12 13 $ dmesg ... ... [  703.8...

install PostgreSQL on openWRT

1.requierment: make sure you can run these command on your shell adduser , deluser, addgroup, delgroup, su 2.install packeages opkg update opkg install pgsql-server pgsql-cli 3. change the path of datebase and log file. uci set postgresql.config.PGDATA=/srv/postgresql/data uci set postgresql.config.PGLOG=/srv/postgresql/data/postgresql.log uci commit 4. initial databse mkdir -p /srv/postgresql/data chown postgres /srv/postgresql/data sudo -u postgres $LC_COLLATE="C" initdb --pwprompt -D /srv/postgresql/data when the command finish, follow the output to start database pg_ctl -D /srv/postgresql/data -l logfile start

xRDP – How to Install on Linux Mint

图片
xRDP on Linux Mint 18.1 Assumptions When we have performed our installation & testing, we have been using the following infrastructure We have performed  a Fresh installation of the   Linux Mint 18.1 We have performed the installation on a  Virtual Machine running on Hyper-V Server and Virtualbox We are assuming that Your Linux Mint machine is connected to Internet (so you can download the necessary packages for the installation to occur). If you  are not connected to internet , you will have to manually download the necessary packages and make them available on your offline machine Installation Process  Step 1 – Install xRDP package At this stage, you should have a Linux Mint machine installed and ready to be used.   Click on Picture for Better Resolution Once logged onto the system, open a terminal and issue the following command  sudo apt-get install xrdp  Click on Picture for Better Res...

搭建无污染DNS服务器

dnscrypt-proxy+dnsmasq搭建无污染DNS服务器 为什么要搭建自己的DNS服务器? 国内的DNS已经被严重污染了,很多的域名返回的都是错误的域名。要防止DNS的污染,就需要用一种加密的DNS协议。DNSCrypt 协议就能满足这种要求,DNSCrypt 是一种加密的DNS协议,有很多的DNS服务器都支持这种协议,支持 DNSCrypt 协议的服务器列表在 这里 。 方案 最好的方案是国内的域名通过国内的DNS服务器(比如114或阿里DNS)查询,国外的通过 DNSCrypt 查询,这就需要dnsmasq的配合。dnsmasq是一个开源的,小巧的DNS服务器,支持很多的配置选项,最大的优点是能通过配置文件指定不同的域名通过不同的DNS服务器来查询。已经有人把这样的配置文件做好了,放在Github上了,叫做 dnsmasq-china-list ,这是一个国内域名列表。 安装和配置 安装和配置参考 这篇文章 。 文章中讲的是编译安装的方式,也可以直接在软件源中安装(软件源中不一定有)。 安装dnscrypt-proxy之前必须安装libsodium,centros中,在安装libsodium之后要执行下面这两行命令,不然configure时会有错误: # echo /usr/local/lib > /etc/ld.so.conf.d/usr_local_lib.conf # ldconfig dnscrypt-proxy 通过添加启动参数来配置的方式比较简单,可以通过下面这条命令来启动 dnscrypt-proxy 服务: # dnscrypt-proxy --resolver-name=4armed --local-address=127.0.0.1:35535 主要需要指定解析服务器和端口,4armed是 解析服务器列表 中的第一个,速度还可以,自己找一个速度比较快的就可以。默认的端口是53,53必须留给dnsmasq用,所以必须换另外一个端口。 dnscrypt-proxy 服务启动之后,用dig命令查询 youtube.com 的 ip 测试一下: $ dig @127.0.0.1 -p 35535 youtube.com ; <<>> DiG 9.9.4...