whitebatman2 / rtl8821CU

Realtek 802.11ac USB WLAN driver
GNU General Public License v2.0
310 stars 177 forks source link

Raspbian Stretch with kernel 4.14 Bluetooth is not working RBPI3+ #15

Open EinSoldiatGott opened 5 years ago

EinSoldiatGott commented 5 years ago

Hi, I haven't been able to get the Bluetooth working, on a RBPI 3B+, with BlueZ 4.49 and a comfast cf-wu910a usb dongle with the chipset 8821CU.

I'm using kernel 4.14 because newer kernels are not generating the /lib/modules/4.xx/build or source folder. On 4.14 I can get the folder installing the headers but no in newer kernels.

I changed the Makefiles for RBPI3 and I'm compiling with:

sudo make ARCH=arm

during the compilation I get the warnings:

/usr/src/rtl8821CU-5.2.5.3/hal/phydm/phydm_hwconfig.c:1310:45: warning: ‘EVM’ may be used uninitialized in this function [-Wmaybe-uninitialized] p_phy_info->rx_mimo_signal_quality[i] = EVM;

/usr/src/rtl8821CU-5.2.5.3/hal/phydm/phydm_adc_sampling.c: In function ‘phydm_la_buffer_allocate’: /usr/src/rtl8821CU-5.2.5.3/hal/phydm/phydm_adc_sampling.c:46:5: warning: this ‘else’ clause does not guard... [-Wmisleading-indentation] } else ^~~~ /usr/src/rtl8821CU-5.2.5.3/hal/phydm/phydm_adc_sampling.c:48:4: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘else’ ret = true;

/usr/src/rtl8821CU-5.2.5.3/hal/btc/halbtc8821c2ant.c: In function ‘halbtc8821c2ant_monitor_wifi_ctr’:
/usr/src/rtl8821CU-5.2.5.3/hal/btc/halbtc8821c2ant.c:454:2: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
  if ((coex_dm->bt_status ==
  ^~
/usr/src/rtl8821CU-5.2.5.3/hal/btc/halbtc8821c2ant.c:461:3: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’
   if (cck_cnt > 250) {
   ^~

After build finishes I run:

$ lsusb | grep Realtek
Bus 001 Device 005: ID 0bda:1a2b Realtek Semiconductor Corp. 
$ sudo modprobe 8821cu
$ lsmod | grep 8821cu
8821cu               1953792  0
cfg80211              573440  2 brcmfmac,8821cu
$ sudo usb_modeswitch -KW -v 0bda -p 1a2b
Take all parameters from the command line

 * usb_modeswitch: handle USB devices with multiple modes
 * Version 2.5.0 (C) Josua Dietze 2017
 * Based on libusb1/libusbx

 ! PLEASE REPORT NEW CONFIGURATIONS !

DefaultVendor=  0x0bda
DefaultProduct= 0x1a2b

StandardEject=1

Look for default devices ...
  found USB ID 0bda:1a2b
   vendor ID matched
   product ID matched
  found USB ID 0bda:1a2b
   vendor ID matched
   product ID matched
  found USB ID 4555:1031
  found USB ID 0424:7800
  found USB ID 0424:2514
  found USB ID 0424:2514
  found USB ID 1d6b:0002
 Found devices in default mode (2)
Access device 004 on bus 001
Get the current device configuration ...
Current configuration number is 1
Use interface number 0
 with class 8
Use endpoints 0x0b (out) and 0x8a (in)

USB description data (for identification)
-------------------------
Manufacturer: Realtek
     Product: DISK
  Serial No.: not provided
-------------------------
Sending standard EJECT sequence
Looking for active driver ...
 OK, driver detached
Set up interface 0
Use endpoint 0x0b for message sending ...
Trying to send message 1 to endpoint 0x0b ...
 OK, message successfully sent
Read the response to message 1 (CSW) ...
 Response successfully read (13 bytes), status 1
Trying to send message 2 to endpoint 0x0b ...
 OK, message successfully sent
Read the response to message 2 (CSW) ...
 Response successfully read (13 bytes), status 0
Trying to send message 3 to endpoint 0x0b ...
 Sending the message returned error -1. Try to continue
Read the response to message 3 (CSW) ...
 Response reading failed (error -1)
 Device is gone, skip any further commands
-> Run lsusb to note any changes. Bye!

The swith mode is working.

I'm not interested in using the dongle as wifi, but with iw I can see the internal interface with a valid MAC:

$ sudo iw dev phy#1 Interface wlan1 ifindex 4 wdev 0x100000001 addr 40:a5:ef:f4:67:11 ssid punto33 type managed txpower 12.00 dBm phy#0 Unnamed/non-netdev interface wdev 0x2 addr fa:d3:44:2a:fe:ce type P2P-device txpower 31.00 dBm Interface wlan0 ifindex 3 wdev 0x1 addr b8:27:eb:ae:ff:e9 ssid punto33 type managed channel 11 (2462 MHz), width: 20 MHz, center1: 2462 MHz txpower 31.00 dBm

But for bluetooth wich is what I need, the module is visible but it is DOWN, and it cannot start it:

$ sudo hciconfig
hci1:   Type: Primary  Bus: USB
    BD Address: 00:00:00:00:00:00  ACL MTU: 0:0  SCO MTU: 0:0
    DOWN 
    RX bytes:504 acl:0 sco:0 events:71 errors:0
    TX bytes:17714 acl:0 sco:0 commands:72 errors:0

hci0:   Type: Primary  Bus: UART
    BD Address: B8:27:EB:51:00:16  ACL MTU: 1021:8  SCO MTU: 64:1
    UP RUNNING 
    RX bytes:799 acl:0 sco:0 events:52 errors:0
    TX bytes:2520 acl:0 sco:0 commands:52 errors:0
$ sudo hciconfig hci1 up
**Can't init device hci1: Cannot assign requested address (99)**
$ sudo hciconfig hci1 down
$ sudo hciconfig hci1 up
**Can't init device hci1: Cannot assign requested address (99)**
$ sudo hciconfig hci1 reset
**Can't init device hci1: Cannot assign requested address (99)**
$ sudo hcitool -i hci0 lescan
LE Scan ...
74:1A:6D:A2:6D:88 (unknown)
55:00:14:AC:88:2B (unknown)
55:00:14:AC:88:2B (unknown)
74:1A:6D:A2:6D:88 (unknown)
49:95:9A:1E:1C:37 (unknown)
$ sudo hcitool -i hci1 lescan
**Invalid device: Network is down**

I did different approaches like upgrading the kernel, using btmgt, but not succes :/