📄 pltst.c
字号:
#include <fcntl.h>#include <sys/ioctl.h>#include <errno.h>#include <stdio.h>#include <unistd.h>#include "plusb.h"int main(int argc, char **argv){ int retval; int i; int j=0; bulk_transfer_t b; int fd1 = open("/dev/plusb", O_RDWR); int fd2 = open("/dev/plusb1", O_RDWR);#if 1 b.size=64; for(i=0;i<b.size;i++) b.data[i]=i; b.pipe=_PLUSB_BULKOUTPIPE; if(!ioctl(fd1 , IOCTL_PLUSB_BULK, &b)) printf("done\n"); #endif#if 1 b.size=64; for(i=0;i<b.size;i++) b.data[i]=b.size-i; b.pipe=_PLUSB_BULKOUTPIPE; if(!ioctl(fd2 , IOCTL_PLUSB_BULK, &b)) printf("done\n"); #endif getchar(); //while(j<2) b.pipe=_PLUSB_BULKINPIPE;#if 1 b.size=64; memset(b.data, 0, 64); if(!ioctl(fd1 , IOCTL_PLUSB_BULK, &b)) printf("done\n"); for(i=0;i<b.size;i++) printf("%02d ",b.data[i]&255); printf("\n");#endif #if 1 b.size=64; if(!ioctl(fd2 , IOCTL_PLUSB_BULK, &b)) printf("done\n"); for(i=0;i<b.size;i++) printf("%02d ",b.data[i]&255); printf("\n"); j++;#endif close(fd1); close(fd2); return 0; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -