完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
大家好,我想在Linux上使用BCM4338,WiFi工作得很好。但是当我在Linux上使用Bluez来测试蓝牙时,它就不起作用了。
首先我用命令的hciattach / dev / ttymxc2 bcm43xx 3000000流T 10的初始化设备,但它会得到的时间,然后我挖到的过程中,我发现该命令将调用函数bcm43xx_init: 遗赠 国际bcm43xx_init(int fd,int,int def_speed,速度,结构p *钛, conchchar *bdADDR) { 字符chip名称〔20〕; Char FWYPATH [ PATHOMAX MAX ]; PrtTf(“BCM43XXIIN n”); 如果(BCM43XXXX复位(FD)) 返回- 1; printf(“复位成功n”);//程序是否能在这里得到 如果(bcm43xx_read_local_name(FD,chip_name,sizeof(chip_name))) 返回- 1; printf(“读本地名称成功n”);//程序是否能在这里得到 如果(bcm43xx_locate_patch(firmware_dir,chip_name,fw_path)){ FPrTNF(STDRR,“补丁未找到,无论如何继续n”); }否则{ 如果(BCM43XXI StidSurt(FD,TI,速度)) 返回- 1; 如果(BCM43XXLoad固件(FD,FWYPATH)) 返回- 1; … 迎接未来 我添加了两个“printf”指出哪里错了,结果表明它能复位成功得到时间。所以它得到了bcm43xx_read_local_name,代码是这样的: 迎接未来 静态变量bcm43xx_read_local_name(int fd,char *的名字,size_t大小) { 无符号char CMD[]{HCIIGracdPyPKT,0x14,0x0C,0x00 }; 无符号字符表; 无符号int NAMEYLLN; RESP= MALOC(大小+ CccMin大小); 如果(!)RESP) 返回- 1; TFLUH(FD,TCIOFLUSH); 如果写(FD,CMD,SIZEOF(CMD))!= siZeof(CMD){ fprintf(stderr,“未能读写本地名称命令n”); 失败; } 它在这里被偷。 如果(Read HycIIAL事件(FD,RESP,size)lt;CcxMixsize){ fprintf(stderr,“无法读取本地名称、无效的HCI事件n”); 失败; } 如果(RESP〔4〕!= CMD〔1〕〉RESP〔5〕!= CMD〔2〕〉RESP〔6〕!= CMDY成功){ fprintf(stderr,“无法读取本地名称,命令失败n”); 失败; } 遗赠 我试了很多次,我发现它被困在read_hci_event功能,主机不能从设备得到回应。但它可以在bcm43xx_reset()响应,所以我认为它是HCI指令的问题,然后我改变了HCI命令多次,原来设备只响应复位HCI指令。我不知道为什么会这样。 BLUZ版本为5.37,Linux内核为4.1.38。 请给我一些建议,非常感谢。 以上来自于百度翻译 以下为原文 Hi everyone, I am trying to use bcm43438 on linux, and the wifi is working well. But when i use Bluez on linux to test the bluetooth, it doesn't work. Firstly i use command 'hciattach /dev/ttymxc2 bcm43xx 3000000 flow -t 10' to init the device, but it will get time out, then I digged into the process, and I found the command will call function bcm43xx_init: `````` int bcm43xx_init(int fd, int def_speed, int speed, struct termios *ti, const char *bdaddr) { char chip_name[20]; char fw_path[PATH_MAX]; printf("bcm43xx_initn"); if (bcm43xx_reset(fd)) return -1; printf("reset successfullyn"); //whether program can get here if (bcm43xx_read_local_name(fd, chip_name, sizeof(chip_name))) return -1; printf("read local name successfullyn"); //whether program can get here if (bcm43xx_locate_patch(FIRMWARE_DIR, chip_name, fw_path)) { fprintf(stderr, "Patch not found, continue anywayn"); } else { if (bcm43xx_set_speed(fd, ti, speed)) return -1; if (bcm43xx_load_firmware(fd, fw_path)) return -1; ..... ````````````````````` I add two 'printf' to indicate where is wrong, and the result shows it can reset successfully then get time out. So it gets time out in bcm43xx_read_local_name, the code is like this: ```````````````````````` static int bcm43xx_read_local_name(int fd, char *name, size_t size) { unsigned char cmd[] = { HCI_COMMAND_PKT, 0x14, 0x0C, 0x00 }; unsigned char *resp; unsigned int name_len; resp = malloc(size + CC_MIN_SIZE); if (!resp) return -1; tcflush(fd, TCIOFLUSH); if (write(fd, cmd, sizeof(cmd)) != sizeof(cmd)) { fprintf(stderr, "Failed to write read local name commandn"); goto fail; } // it is stucked here if (read_hci_event(fd, resp, size) < CC_MIN_SIZE) { fprintf(stderr, "Failed to read local name, invalid HCI eventn"); goto fail; } if (resp[4] != cmd[1] || resp[5] != cmd[2] || resp[6] != CMD_SUCCESS) { fprintf(stderr, "Failed to read local name, command failuren"); goto fail; } ````` After I tried many times, I found it is stucked in read_hci_event function, the host can not get response from device. But it can get response in bcm43xx_reset(), so i think it is the problem of hci command, then i changed the hci command many times, it turned out the device only response to the reset hci command. I don't know why is it so. The Bluez version is 5.37 and the linux kernel is 4.1.38. Please give me some advice, thanks very much. |
|
相关推荐
2个回答
|
|
你和哪个合作伙伴和合作伙伴一起工作?
物联网解决方案指南 以上来自于百度翻译 以下为原文 Which partner and partner module are you working with? IoT Solutions Guide |
|
|
|
|
|
|
|
只有小组成员才能发言,加入小组>>
752个成员聚集在这个小组
加入小组2069 浏览 1 评论
1824 浏览 1 评论
3633 浏览 1 评论
请问可以直接使用来自FX2LP固件的端点向主机FIFO写入数据吗?
1760 浏览 6 评论
1509 浏览 1 评论
CY8C4025LQI在程序中调用函数,通过示波器观察SCL引脚波形,无法将pin0.4(SCL)下拉是什么原因导致?
507浏览 2评论
CYUSB3065焊接到USB3.0 TYPE-B口的焊接触点就无法使用是什么原因导致的?
357浏览 2评论
CX3连接Camera修改分辨率之后,播放器无法播出camera的画面怎么解决?
410浏览 2评论
357浏览 2评论
使用stm32+cyw43438 wifi驱动whd,WHD驱动固件加载失败的原因?
854浏览 2评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-22 06:17 , Processed in 0.983757 second(s), Total 79, Slave 62 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号