Jump to content
2 posts in this topic

Recommended Posts

I have been working on a firmware uploader for devices with the Realtek 8723b chipset and appear to be stuck. It appears like the pipe is opened and the data is sent, but the radio fails to start. This is my first attempt at something like this so I am curious if someone can review and see if I am missing something. I have attached a file that includes my Xcode project, the linux version of the driver which includes the firmware (rtl8723b_fw), and a log of what the kext produces. The logged data can also be found below. Any help or guidance would be greatly appreciated.

 

2019-12-24 14:28:19.098848-0700 0x434      Default     0x0                  0      0    kernel: Realtek8723bt::probe(Bluetooth Radio)
2019-12-24 14:28:19.098853-0700 0x434      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: Realtek8723bt(<private>)::probe
2019-12-24 14:28:19.098875-0700 0x434      Default     0x0                  0      0    kernel: Realtek8723bt::start(Bluetooth Radio) <1>
2019-12-24 14:28:19.098881-0700 0x434      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: Starting
2019-12-24 14:28:19.098884-0700 0x434      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: Opening interface
2019-12-24 14:28:19.098911-0700 0x434      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: findPipe: direction = 0, type = 2
2019-12-24 14:28:19.098918-0700 0x434      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: endpoint found: epDirection = 1, epType = 3
2019-12-24 14:28:19.098924-0700 0x434      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: endpoint found: epDirection = 0, epType = 2
2019-12-24 14:28:19.098929-0700 0x434      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: found matching endpoint
2019-12-24 14:28:19.099198-0700 0x434      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: Started OK
2019-12-24 14:28:19.099210-0700 0x434      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: Attempting write
2019-12-24 14:28:19.099214-0700 0x434      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: buffer size 45540..
2019-12-24 14:28:19.099326-0700 0x434      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: buffer size 44516..
2019-12-24 14:28:19.099396-0700 0x434      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: buffer size 43492..
2019-12-24 14:28:19.099465-0700 0x434      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: buffer size 42468..
2019-12-24 14:28:19.099542-0700 0x434      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: buffer size 41444..
2019-12-24 14:28:19.099608-0700 0x434      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: buffer size 40420..
2019-12-24 14:28:19.099679-0700 0x434      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: buffer size 39396..
2019-12-24 14:28:19.099739-0700 0x434      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: buffer size 38372..
2019-12-24 14:28:19.099818-0700 0x434      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: buffer size 37348..
2019-12-24 14:28:19.099893-0700 0x434      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: buffer size 36324..
2019-12-24 14:28:19.100007-0700 0x434      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: buffer size 35300..
2019-12-24 14:28:19.100114-0700 0x434      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: buffer size 34276..
2019-12-24 14:28:19.100230-0700 0x434      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: buffer size 33252..
2019-12-24 14:28:19.100311-0700 0x434      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: buffer size 32228..
2019-12-24 14:28:19.100384-0700 0x434      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: buffer size 31204..
2019-12-24 14:28:19.100456-0700 0x434      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: buffer size 30180..
2019-12-24 14:28:19.100524-0700 0x434      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: buffer size 29156..
2019-12-24 14:28:19.100582-0700 0x434      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: buffer size 28132..
2019-12-24 14:28:19.100649-0700 0x434      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: buffer size 27108..
2019-12-24 14:28:19.100747-0700 0x434      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: buffer size 26084..
2019-12-24 14:28:19.100831-0700 0x434      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: buffer size 25060..
2019-12-24 14:28:19.100924-0700 0x434      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: buffer size 24036..
2019-12-24 14:28:19.100988-0700 0x434      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: buffer size 23012..
2019-12-24 14:28:19.101057-0700 0x434      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: buffer size 21988..
2019-12-24 14:28:19.101137-0700 0x434      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: buffer size 20964..
2019-12-24 14:28:19.101202-0700 0x434      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: buffer size 19940..
2019-12-24 14:28:19.101263-0700 0x434      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: buffer size 18916..
2019-12-24 14:28:19.101352-0700 0x434      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: buffer size 17892..
2019-12-24 14:28:19.101434-0700 0x434      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: buffer size 16868..
2019-12-24 14:28:19.101504-0700 0x434      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: buffer size 15844..
2019-12-24 14:28:19.101568-0700 0x434      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: buffer size 14820..
2019-12-24 14:28:19.101642-0700 0x434      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: buffer size 13796..
2019-12-24 14:28:19.101708-0700 0x434      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: buffer size 12772..
2019-12-24 14:28:19.101887-0700 0x434      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: buffer size 11748..
2019-12-24 14:28:19.101990-0700 0x434      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: buffer size 10724..
2019-12-24 14:28:19.102094-0700 0x434      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: buffer size 9700..
2019-12-24 14:28:19.102167-0700 0x434      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: buffer size 8676..
2019-12-24 14:28:19.102227-0700 0x434      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: buffer size 7652..
2019-12-24 14:28:19.102292-0700 0x434      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: buffer size 6628..
2019-12-24 14:28:19.102399-0700 0x434      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: buffer size 5604..
2019-12-24 14:28:19.102473-0700 0x434      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: buffer size 4580..
2019-12-24 14:28:19.102536-0700 0x434      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: buffer size 3556..
2019-12-24 14:28:19.102602-0700 0x434      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: buffer size 2532..
2019-12-24 14:28:19.102666-0700 0x434      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: buffer size 1508..
2019-12-24 14:28:19.102729-0700 0x434      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: buffer size 484..
2019-12-24 14:28:19.102781-0700 0x434      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: Realtek8723bt(<private>)::probe - firmware was sent to bulk pipe
2019-12-24 14:28:19.102786-0700 0x434      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: Getting status
2019-12-24 14:28:19.102793-0700 0x434      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: Firmware result: success
2019-12-24 14:28:19.102823-0700 0x434      Default     0x0                  0      0    kernel: Realtek8723bt::start(Bluetooth Radio) <1> failed
 

Realtek8723bt.zip

  • 2 weeks later...

Small update seem to be going in reverse a bit. I upgraded to Catalina and now the write is not attempted per the logging below. Does anyone know if something changed in Catalina where the writing to the pipe needs to be modified in some way? Also in doing more research I looked at the lwfinger driver and all it appears to do at a glance is just uploads the firmware and then hand offs to the driver. I think if we get the uploader right here this will work. 

 

https://github.com/lwfinger/realtek_bluetooth/blob/master/btrtl.c

 

Quote

2020-01-05 14:45:54.740823-0700 0x240      Default     0x0                  0      0    kernel: Notice - new kext com.apple.driver.usb.AppleUSBHostPlatformProperties, v1.2 matches prelinked kext but can't determine if executables are the same (no UUIDs).
2020-01-05 14:45:54.768373-0700 0x240      Default     0x0                  0      0    kernel: IOUSBHostInterface: family specific matching fails
2020-01-05 14:45:54.768382-0700 0x240      Default     0x0                  0      0    kernel: Bluetooth Radio: family specific matching fails
2020-01-05 14:45:54.768385-0700 0x240      Default     0x0                  0      0    kernel: Edimax Wi-Fi N150 Bluetooth4.0 USB Adapter: family specific matching fails
2020-01-05 14:45:54.768387-0700 0x240      Default     0x0                  0      0    kernel: Matching service count = 1
2020-01-05 14:45:54.770445-0700 0x53c      Default     0x0                  0      0    kernel: Realtek8723bt::probe(Bluetooth Radio)
2020-01-05 14:45:54.770448-0700 0x53c      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: Realtek8723bt(<private>)::probe
2020-01-05 14:45:54.770458-0700 0x53c      Default     0x0                  0      0    kernel: Realtek8723bt::start(Bluetooth Radio) <1>
2020-01-05 14:45:54.770462-0700 0x53c      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: Starting
2020-01-05 14:45:54.770464-0700 0x53c      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: Opening interface
2020-01-05 14:45:54.770484-0700 0x53c      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: findPipe: direction = 0, type = 2
2020-01-05 14:45:54.770489-0700 0x53c      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: endpoint found: epDirection = 1, epType = 3
2020-01-05 14:45:54.770493-0700 0x53c      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: endpoint found: epDirection = 0, epType = 2
2020-01-05 14:45:54.770497-0700 0x53c      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: found matching endpoint
2020-01-05 14:45:54.770751-0700 0x53c      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: Started OK
2020-01-05 14:45:54.770759-0700 0x53c      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: Attempting write
2020-01-05 14:45:54.770761-0700 0x53c      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: buffer size 45540..
2020-01-05 14:45:54.770770-0700 0x53c      Default     0x0                  0      0    kernel: (IOUSBHostFamily) 000012.307714 AppleUSBIORequest: AppleUSBIORequest::cancel: called without first calling prepare
2020-01-05 14:45:54.770780-0700 0x53c      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: Realtek8723bt(<private>)::probe - failed to write firmware to bulk pipe (err:-536870206, block:1, to_send:1024)
2020-01-05 14:45:54.770820-0700 0x53c      Default     0x0                  0      0    kernel: (Realtek8723bt) Realtek8723bt: Firmware result: success
2020-01-05 14:45:54.770828-0700 0x53c      Default     0x0                  0      0    kernel: Realtek8723bt::start(Bluetooth Radio) <1> failed

 

×
×
  • Create New...