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);
相关文档:
step1:
在ubuntu里面右击要共享的文件夹,会提示安装软件,选择安装即可;
step2:
实现xp匿名访问Ubuntu共享文件夹, 则只需修改/etc/samba/smb.co ......
看源代码。
#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 ......
原文地址:
Linux Ubuntu 9.1 fcitx 小企鹅 中文输入法安装
作者:
渐行渐远的船
安装Ubuntu9.1,选择中文安装。
安装好后,Ubuntu已经自带了一个ibus中文输入法,可是用起来很不爽,不如小企鹅方便。
安装小企鹅方法,和网上的比较,这里的可能是比较简单的了,配置要简单多了。电脑要联网 ......