linux 网络键盘,鼠标
因为公司的板子上键盘不好按,所以写个网络版的,方便调试。
client .c
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <linux/input.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
#include <netdb.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <sys/socket.h>
int connect_server(char * ipaddr, int myport)
{
int sockfd;
struct hostent *he;
struct sockaddr_in their_addr;
if((he=gethostbyname(ipaddr))==NULL) {
herror("gethostbyname");
return -1;
}
if ((sockfd = socket(PF_INET, SOCK_STREAM, 0)) == -1) {
perror("socket");
return -1;
}
their_addr.sin_family = PF_INET;
their_addr.sin_port = htons(myport);
their_addr.sin_addr = *((struct in_addr *)he->h_addr);
bzero(&(their_addr.sin_zero),0);
if (connect(sockfd, (struct sockaddr *)&their_addr, sizeof(struct sockaddr)) == -1) {
perror("connect");
return -1;
}
return sockfd;
}
int main(void)
{
int fds[16] = {-1};
int fd_max = -1;
char serverip[24] = {0};
int socketfd = -1;
int ret = 0;
struct input_event event_key;
char input[5*1024] = {0};
int fd = open("/proc/bus/input/devices", O_RDWR);
char dev[24] = "/dev/input/";
int len = read(fd, input, 5*1024);
printf("len = %d \n", len);
close(fd);
char *p;
p = input;
int j = 0;
strcpy(serverip, "192.168.168.114");
socketfd = connect_server(serverip, 7838);
if(socketfd == -1)
{
printf("connect_server faild \n");
return -1;
}
struct timeval select_timeout;
fd_set readfds;
select_timeout.tv_sec= 4;
select_timeout.tv_usec = 0;
for(; p != NULL; j++)
{
p = strstr(p, "event");
if (p)
{
memcpy(dev+11, p, 6);
printf("%s\n", dev);
p+= 6;
fds[j] = open(dev, O_RDWR);
相关文档:
看源代码。
#include <linux/kernel.h>
#include <linux/module.h>
#if CONFIG_MODVERSIONS==1
#define MODVERSIONS
#include <linux/modversions.h>
#endif
int init_module()
{
printk("Hello, I'm kernel\n");
return 0;
}
void cleanup_module()
{
printk("I'm kernel, bye\n");
} ......
1 首先ORACLE_SID问题
[oracle@paopao ~]$ echo $ORACLE_SID
orcl
因为要创建的数据库名为orcl1,所以更改ORACLE_SID如下:
[oracle@paopao ~]$ export ORACLE_SID=orcl1
2 准备初始化参数文件
##########################################################################
####
# Copyright (c) 19 ......
备份控制文件包括三种方法:
(1)通过操作系统命令在数据库关闭时对控制文件进行COPY;
(2)利用ALTER DATABASE BACKUP CONTROLFILE TO命令将控制文件备份到二进制文件;
SQL> alter database backup controlfile to 'E:\oracle\product\10.2.0\orcl\controlfile01.bak';
数据库已更改。
(3)利用ALTER DATABASE BACKU ......
1号进程,pid为1的进程,又称init进程。
linux系统启动后,第一个被创建的用户态进程就是init进程。它有两项使命:
1、执行系统初始化脚本,创建一系列的进程(它们都是init进程的子孙);
2、在一个死循环中等待其子进程的退出事件,并调用waitid系统调用来完成“收尸”工作;
init进程不会被暂 ......
1.下载linux kernel源代码
到http://www.kernel.org/下载linux内核源代码,这里我们使用2.6.24.4的内核.
解压linux-2.6.24.4.tar.bz2
[matt@localhost GEC2410]$ tar -xvjf linux-2.6.24.4.tar.bz2
[matt@localhost GEC2410]$ cd linux-2.6.24.4
2.修改Makefile,设置交叉编译器
ARCH ?= arm
CROSS_COMPILE ......