USB硬件键盘鼠标控制器V2.0 支持Linxu

本文介绍了如何在Red Hat Linux 9.0环境下,通过串口连接USB硬件键盘鼠标控制器V2.0。文章详细展示了如何进行串口设置、编译及执行测试程序comtest,并给出了comtest.c的源代码,该代码用于配置串口参数并发送数据。
摘要由CSDN通过智能技术生成

Red Hat Linux 9.0 测试编译


默认com1  9600,n,8,1


1.接上板子的串口线在com1,接上usb线

2.编译: gcc -o comtest comtest.c

3.执行: ./comtest

4.鼠标移动

 

www.laorenshen.cn
2010.05

 

 

 

comtest.c 代码如下:

 

#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <errno.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <termios.h>
#include <stdlib.h>

int set_opt(int fd,int nSpeed, int nBits, char nEvent, int nStop)
{
 struct termios newtio,oldtio;
 if  ( tcgetattr( fd,&oldtio)  !=  0) {
  perror("SetupSerial 1");
  return -1;
 }
 bzero( &newtio, sizeof( newtio ) );
 newtio.c_cflag  |=  CLOCAL | CREAD;
 newtio.c_cflag &= ~CSI

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

老人参

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值