Linux高级应用(五)如何通过网络下载图片到试验箱

1、配置PC网卡的IP地址
注意:PC机是双网卡的,配置连接实验箱的网卡的IP。
(通过插拔试验箱的网线来判断)

IP地址:192.168.0.2
子网掩码:255.255.255.0
默认网关:192.168.0.1

2、配置试验箱的IP
secureCRT中设置:

查看网卡:
[root@FriendlyARM /test]# ifconfig
eth0 Link encap:Ethernet HWaddr 08:90:00:A0:02:10
inet addr:192.168.1.230 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:337 errors:0 dropped:0 overruns:0 frame:0
TX packets:14 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:41225 (40.2 KiB) TX bytes:3204 (3.1 KiB)
Interrupt:39 Base address:0x8000

配置网卡的IP—192.168.0.3
[root@FriendlyARM /test]# ifconfig eth0 192.168.0.3

注意:实验箱重启后,需要重新配置IP

3、试验箱和PC机互ping
1)试验箱–>PC机
[root@FriendlyARM /test]# ping 192.168.0.2
PING 192.168.0.2 (192.168.0.2): 56 data bytes
64 bytes from 192.168.0.2: seq=0 ttl=128 time=5.524 ms
64 bytes from 192.168.0.2: seq=1 ttl=128 time=0.266 ms
64 bytes from 192.168.0.2: seq=2 ttl=128 time=0.177 ms
64 bytes from 192.168.0.2: seq=3 ttl=128 time=0.201 ms

2)PC机–>试验箱
ping 192.168.0.3

注意:
windows防火墙需要关闭
最好先关闭wifi

4、在PC上打开tftp服务器
tftpd32.exe

注意:选择连接试验箱的网卡IP–192.168.0.2
browse设置需要下载图片的文件夹

5、使用tftp下载文件到试验箱
secureCRT中:
[root@FriendlyARM /test]# tftp 192.168.0.2 -g -r main.bmp
main.bmp 100% || 1125k --:–:-- ETA
[root@FriendlyARM /test]# tftp 192.168.0.2 -g -r control.bmp
control.bmp 100% |
| 1125k --:–:-- ETA
[root@FriendlyARM /test]#

注意:
192.168.0.2 ----PC机(tftp服务器的IP)
-g ----get
-r ----remote

6、上传文件

[root@FriendlyARM /test]# ls
1.bmp 2.bmp control.bmp main main.bmp test
[root@FriendlyARM /test]# tftp 192.168.0.2 -p -l 2.bmp
2.bmp 100% |*******************************| 1125k --:–:-- ETA
[root@FriendlyARM /test]#

注意:
-p ----- put
-l ----- local

左上角

type=3.code=53,value=20   ---->x轴坐标值
type=3.code=54,value=48   ---->y轴坐标值
type=3.code=48,value=200  ---->触摸屏按下
type=3.code=57,value=0    ---->触摸屏松开
type=0.code=2,value=0     ---->同步事件
type=0.code=0,value=0     ---->同步事件

右上角
type=3.code=53,value=768
type=3.code=54,value=61
type=3.code=48,value=200
type=3.code=57,value=0
type=0.code=2,value=0
type=0.code=0,value=0


左下角
type=3.code=53,value=22
type=3.code=54,value=410
type=3.code=48,value=200
type=3.code=57,value=0
type=0.code=2,value=0
type=0.code=0,value=0

右下角

type=3.code=53,value=745
type=3.code=54,value=407
type=3.code=48,value=200
type=3.code=57,value=0
type=0.code=2,value=0
type=0.code=0,value=0
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <linux/input.h>

int main(void)
{
	struct input_event ts_data;
	//1)打开触摸屏
	int fd_ts;
	fd_ts = open("/dev/input/event1", O_RDONLY);
	if(fd_ts == -1)
	{
		perror("open ts error");
		return -1;
	}
	//2)读取触摸屏数据
	while(1)
	{
		read(fd_ts, &ts_data, sizeof(struct input_event));
		printf("type=%d.code=%d,value=%d\n", ts_data.type,ts_data.code,ts_data.value);
	}
	//3)关闭触摸屏
	close(fd_ts);
	
	return 0;
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值