linux系統(tǒng)中pthread_t定義,鍵盤消失和lcd休眠解決方法

第一:linux系統(tǒng)中pthread_t定義
在linux中可以使用pthread_t來查看對應(yīng)變量的定義
#include <pthread.h>
#include <unistd.h>
pthread_t;
? ?/* Thread identifiers. ?The structure of the attribute type is not
? exposed on purpose. ?*/
? ?typedef unsigned long int pthread_t;
總結(jié):可以看到pthread_t 就是unsigned long int ,在本系統(tǒng)中占用8個字節(jié)
,即為uint64,打印線程ID需要用%lu格式。
第二: linux右上角鍵盤消失
如果用的是ibus:
1. 先把原先的ibus進(jìn)程kill掉
killall ?ibus-daemon
2. 啟動一個新的ibus進(jìn)程
ibus-daemon ? ?-d
然后就可以看見鍵盤圖標(biāo)又出現(xiàn)在右上角了
如果使用的是fcitx的小企鵝輸入法:
1. killall fcitx
2. fcitx -d
就看到右上角的輸入法圖標(biāo)了
第三:linux內(nèi)核下lcd屏幕自動休眠方法
臨時解決方法一:echo 0 > /sys/class/graphics/fb0/blank
長期解決辦法二:
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
int main(int argc, char *argv[])
{
int fd;
fd = open("/dev/tty0",O_RDWR);
write(fd, “\033[9;0]”, 8);
close(fd);
return 0;
}
1.程序存為display_time.c
2 交叉編譯 arm-linux-gcc -o display_time display_time.c
3.display_time復(fù)制到根目錄下
4 運行 ./display_time
如果要開機(jī)自動啟動,復(fù)制到根目錄后,在/etc/init.d/rcS里加上一句 /display_time 。
? ?點贊+關(guān)注,不迷路,謝謝大家。