2410开发板蓝牙串口向手机发送数据

chinayi9209 2008-03-13 09:53:03
各位大哥高手:
小弟想在sbc2410开发板通过蓝牙串口和手机串口发送数据,调试不成功。
蓝牙协议栈及驱动都已经安装成功。配置如下:
hciconfig hci0 up
sdptool add --channel=1 SP
rfcomm bindi 0 手机MAC
mknod /dev/rfcomm0 c 216 0
hcitool cc 手机MAC
错误情况:
发送几次之后控制台打出USB disconnect on device,然后又马上注册上了.
不知道是不是驱动不稳定的原因?板子上的内核版本是2.4.18.打的bluez.org
网站上download的patch.蓝牙协议栈版本2.17
驱动就是内核代码中自带的.没有任何修改.
程序如下:
int main(int argc, char **argv)
{
int fd;
int i = 1;
int nwrite;
int nwrite1;
unsigned char * buff[2*1024];
char *dev ="/dev/rfcomm0";
char* file = "./configure";
FILE * fp;
fd = OpenDev(dev);
if (fd>0)
set_speed(fd,19200);
else
{
printf("Can't Open Serial Port!\n");
exit(0);
}

if (set_Parity(fd,8,1,'N')== FALSE)

{

printf("Set Parity Error\n");

exit(1);

}



if((fp = fopen(file,"rb")) == NULL)

{

printf("Failed to open the mfs file\n");

exit(1);

}
while(!feof(fp))
{
while(nwrite = fread(buff, 1, 2*1024, fp))
{
if(nwrite < 0)
{
printf("\nnwrite < 0\n");
break;
}
nwrite = write(fd,buff,nwrite);
if(nwrite > 0)
{
printf("\ntimes %d ,Len %d\n",i, nwrite);
//printf("\nfile is %s\n", file);
}
i++;
}
}
fclose(fp);
close(fd);
}
...全文
160 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
fanghw 2008-04-28
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 ppzzhhsky 的回复:]
设备驱动没有装好
[/Quote]

同意............................................
szmuma 2008-03-23
  • 打赏
  • 举报
回复
支持一下
ppzzhhsky 2008-03-13
  • 打赏
  • 举报
回复
设备驱动没有装好

6,125

社区成员

发帖
与我相关
我的任务
社区描述
硬件/嵌入开发 硬件设计
社区管理员
  • 硬件设计社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧