版主,你好,我用内核中的通用串口驱动generic.c,编译后,将STM32的USB接口(虚拟串口)插入mini6410开发板中,板上显示信息为:
# usb 1-1: new full speed USB device using s3c2410-ohci and address 2
usb 1-1: New USB device found, idVendor=0483, idProduct=5740
usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 1-1: Product: STM32 Virtual COM Port
usb 1-1: Manufacturer: STMicroelectronics
usb 1-1: SerialNumber: Demo 1.000
one_wire_status: 4
usbserial_generic 1-1:1.0: Generic device with no bulk out, not allowed.
usbserial_generic: probe of 1-1:1.0 failed with error -5
usbserial_generic 1-1:1.1: generic converter detected
usb 1-1: generic converter now attached to ttyUSB0
这是显示设备已经挂载到开发板上了吧, 我自己写了个应用程序:
#include<stdio.h>
#include<linux/fs.h>
#include<stdlib.h>
#include<unistd.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
int main()
{
char Buf[40];
int handle;
//*buffer="This data is from USB device in Linux";
handle=open("/dev/ttyUSB0", O_RDWR);
if(handle==-1)
{
printf("open failure");
}
strcpy(Buf,"This data is from USB device in Linux");
write(handle, Buf,38);
read(handle, Buf, 38);
close(handle);
return 0;
}
程序应该没错吧,但是不知道数据写到哪个缓冲区了。请楼主帮我看看吧,万分感谢