win7開WIFI熱點, xrdp遠程, zsh 主題亂碼, watchdog啓用, 在線Linux內核, WebRTC

netsh wlan set hostednetwork mode=allow ssid=mywifi  key=12345678html

 開啓成功後,網絡鏈接中會多出一個網卡爲「Microsoft Virtual WiFi Miniport Adapter」的無線鏈接2linux

單擊已鏈接到Internet的網絡鏈接,選擇「屬性」→「共享」,勾上「容許其餘······鏈接(N)」並選擇「無線鏈接2」。ios

若是此步報錯,看服務裏面的ICS服務及依賴服務, 還有windows firewall防火牆必定要開啓。git

netsh wlan start hostednetwork       至此,虛擬WiFi的紅叉叉消失,WiFi基站已組建好。github

 顯示無線網絡信息命令:  netsh wlan show hostednetworkweb

 https://daniel.haxx.se/docs/sshproxy.htmlwindows


 

sudo apt-get install xrdp
sudo apt-get install vnc4server tightvncserver
echo "xfce4-session" >~/.xsession
sudo gedit /etc/xrdp/startwm.sh 在. /etc/X11/Xsession 前一行插入網絡

xfce4-sessionsession

sudo service xrdp restartssh

搞定,成功使用遠程桌面鏈接圖形界面, 保持上一次遠程打開的圖形桌面需增長以下
[xrdp8]
name=Reconnect
lib=libvnc.so
username=ask
password=ask
ip=127.0.0.1
port=5910

解決:ftp命令行不支持目錄下載
經過wget獲得解決
#wget ftp://IP:PORT/XXX/* --ftp-user=xxx --ftp-password=xxx -r


zsh的agnoster主題亂碼

wget https://raw.githubusercontent.com/powerline/powerline/develop/font/10-powerline-symbols.conf

wget https://raw.githubusercontent.com/powerline/powerline/develop/font/PowerlineSymbols.otf
sudo cp 10-powerline-symbols.conf /usr/share/fonts/OTF/ 
sudo mv 10-powerline-symbols.conf /etc/fonts/conf.d/
sudo mv PowerlineSymbols.otf /usr/share/fonts/OTF/

 


# modinfo softdog    
filename: /lib/modules/3.2.0-4-686-pae/kernel/drivers/watchdog/softdog.ko

2. 加載模塊

# insmod /lib/modules/3.2.0-4-686-pae/kernel/drivers/watchdog/softdog.ko

3. 此刻可見/dev/watchdog, 或建立 

 # mknod /dev/watchdog c 10 130

4. 查看dev並賦予權限

# ls -l /dev/watchdog 
crw------- 1 root root 10, 130 Mar 21 16:27 /dev/watchdog

# chmod o+rw /dev/watchdog

5. 測試使用watch dog

簡單可寫爲:

# echo 0 > /dev/watchdog         ///今後刻起計時,啓用watchdog

# echo -n V > /dev/watchdog    ///停用watchdog

 

6. 硬件與軟件watchdog的區別 
硬件watchdog必須有硬件電路支持, 設備節點/dev/watchdog對應着真實的物理設備, 不一樣類型的硬件watchdog設備由相應的硬件驅動管理。軟件watchdog由一內核模塊softdog.ko 經過定時器機制實現,/dev/watchdog並不對應着真實的物理設備,只是爲應用提供了一個與操做硬件watchdog相同的接口。 

硬件watchdog比軟件watchdog有更好的可靠性。 軟件watchdog基於內核的定時器實現,當內核或中斷出現異常時,軟件watchdog將會失效。而硬件watchdog由自身的硬件電路控制, 獨立於內核。不管當前系統狀態如何,硬件watchdog在設定的時間間隔內沒有被執行寫操做,仍會從新啓動系統

 

看門狗是混雜設備,因此主設備號是10,/include/linux/miscdevice.h 中定義他的次設備號爲130

 1 #include <stdio.h>
 2 #include <stdlib.h>
 3 #include <unistd.h>
 4 
 5 #include <sys/types.h>
 6 #include <sys/stat.h>
 7 #include <fcntl.h>
 8 #include <termios.h>
 9 #include <errno.h>
10 #include <signal.h>
11 #include <time.h>
12 #include <pthread.h>
13 #include <sys/time.h>
14 #include <linux/watchdog.h>
15 #include <sys/ioctl.h>
16  
17 time_t  backTime;
18 struct tm *pBackTime;
19 int wt_fd;
20  
21 static void sigAlarm(int sig)
22 {
23     char flag = '0';
24     (void)time(&backTime);
25     pBackTime= localtime(&backTime);
26     printf("day: %d; hour: %d; min: %d; sec: %d\n", pBackTime->tm_mday, pBackTime->tm_hour, pBackTime->tm_min, pBackTime->tm_sec);
27  
28     write(wt_fd, &flag, 1); //Reset Watchdog  喂狗
29     alarm(2);
30     return;
31 }
32  
33 
34 int main()
35 {
36        char flag = 'V';
37        int ret;
38        int timeout = 42;
39        
40        if(SIG_ERR == signal(SIGALRM, sigAlarm))
41        {
42            perror("signal (SIGALARM) error");
43        }
44  
45        wt_fd = open("/dev/watchdog", O_RDWR);
46        if(wt_fd <= 0)
47        {
48            printf("Fail to open watchdog  device!\n");
49        }
50        else
51        {
52            write(wt_fd,NULL,0);
53            printf("Turn on Watch Dog\n");
54            ret = ioctl(wt_fd, WDIOC_SETTIMEOUT, &timeout);
55            if(EINVAL == ret)
56            {
57                 printf("EINVAL Returned\n");
58            }
59            else if(EFAULT == ret)
60            {
61                 printf("EFAULT Returned\n");
62            }
63            else if(0 == ret)
64            {
65                 printf("Set timeout %d secs success\n", timeout);
66            }
67            else
68            {
69                 printf("Ret %d\n", ret);
70            }
71        }
72  
73        alarm(3);
74  
75        while(1);
76  
77        write(wt_fd, &flag, 1);
78        printf("Turned off Watch Dog\n");
79        close(wt_fd);
80        return 0;
81 }
View Code

 


在線Linux 內核代碼

http://lxr.linux.no/          1st
http://fxr.watson.org/
http://sourceforge.net/projects/lxr/

 


http://blog.sina.com.cn/s/blog_69a04cf401016gz4.html

相關文章
相關標籤/搜索