neurobin / MT7630E

Modified easy installation package
https://neurobin.org/projects/softwares/unix/MT7630E/
232 stars 70 forks source link

Patch Bluetooth on Ubuntu 17.04 - 4.10.0-20-generic didn't work #66

Closed j1cs closed 7 years ago

j1cs commented 7 years ago

System info

Entry Details
OS Ubuntu 17.04 64-bit
Kernel version 4.10.0-20-generic
New install yes
DKMS no
Compiler gcc version 6.3.0 20170406 (Ubuntu 6.3.0-12ubuntu2)

Devince info

Device ID: 0e8d:763f

General info:

03:00.0 Network controller: MEDIATEK Corp. MT7630e 802.11bgn Wireless Network Adapter
    Subsystem: Foxconn International, Inc. MT7630e 802.11bgn Wireless Network Adapter
    Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
    Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort+ >SERR- <PERR- INTx-
    Latency: 0, Cache Line Size: 64 bytes
    Interrupt: pin A routed to IRQ 19
    Region 0: Memory at 9b100000 (32-bit, non-prefetchable) [size=1M]
    Capabilities: <access denied>
    Kernel driver in use: mt7630e
    Kernel modules: mt7630e

Bluetooth stats:

0: phy0: Wireless LAN
    Soft blocked: no
    Hard blocked: no
1: asus-wlan: Wireless LAN
    Soft blocked: no
    Hard blocked: no
2: asus-bluetooth: Bluetooth
    Soft blocked: no
    Hard blocked: no

What didn't work?

Trying patch the Bluetooth it doesn't turn on.

What did you try?

I tried the patch sudo ./bpatch and after reboot the bluetooth doesn't turn on. When I check lsmod showed me:

bluetooth             557056  10 btrtl,btintel,bnep,btbcm

the module it wasn't installed, so I tried to install manually: sudo modprobe btusb and showed me an error.

Error code:

$ sudo modprobe btusb
modprobe: ERROR: could not insert 'btusb': Exec format error
neurobin commented 7 years ago

Can you try the manual way: https://github.com/neurobin/MT7630E/wiki/Get-bluetooth-working-in-Linux-kernel--with-mt7630e ? so that we can detect where the problem lies.

j1cs commented 7 years ago

Well I added the follow lines into the module:

#define BTUSB_REALTEK           0x20000
#define BTUSB_BCM2045           0x40000
#define BTUSB_IFNUM_2           0x80000
#define BTUSB_CW6622            0x100000
#define BTUSB_MEDIATEK          0X200000
/* MediaTek MT76x0E */
{ USB_DEVICE(0x0e8d, 0x763f), .driver_info = BTUSB_MEDIATEK },
if (id->driver_info & BTUSB_MEDIATEK) {
  set_bit(HCI_QUIRK_BROKEN_LOCAL_COMMANDS, &hdev->quirks);
}
sudo cp drivers/bluetooth/btusb.ko /lib/modules/$(uname -r)/kernel/drivers/bluetooth
$ sudo modprobe btusbmodprobe: 
ERROR: could not insert 'btusb': Exec format error

It's correct put 0x200000 in "define" section?

j1cs commented 7 years ago

Ok so the funny part is that I compile btusb.o vanilla then copy and run modprobe displayed the same error -.- It could be some bug with btusb driver?

neurobin commented 7 years ago

It's correct put 0x200000 in "define" section? yes

Actually the bluetooth causes some problems on my end too (with 4.4.0-75-generic). Sometimes it takes several restart for the bluetooth icon to show up, and this behavior is not consistent. But, as I hardly use bluetooth, I hardly notice it.

j1cs commented 7 years ago

Ok so I will try this solution. Thanks However Why when I run sudo modprobe btusb give an error? because it doesn't load the module at all

jeremyb31 commented 7 years ago

Hello neurobin, glats provided more info at https://askubuntu.com/questions/915235/error-to-load-module-btusb-with-kernel-4-10-0-20-generic It looks like they compiled using the wrong kernel header files somehow

j1cs commented 7 years ago

Hi @jeremyb31 Did you see the bpatch script? Maybe we can change some instruction to work properly

jeremyb31 commented 7 years ago

The script should work correctly from what I see

Pilleo commented 7 years ago

@glats , @jeremyb31 , @neurobin Maybe that is the same bug as this @neurobin suggested to make a bugreport for the linux kernel in order to make bluetooth patching not necessary. But at this point I cannot say what this report should tell about. Suggestions?

jeremyb31 commented 7 years ago

Just say the current kernel source code doesn't correctly support the bluetooth device and link to the bpatch script as the solution.

saurabh-mhaisekar commented 7 years ago

That's strange I recently used the script and it's working fine for me. Ubuntu 17.04

j1cs commented 7 years ago

Guys, recently my laptop was stolen and I think that I will not know what the problem is. So I'll close the issue. Thanks

dsapandora commented 7 years ago

Guys, I have been trying for a while but I still have trouble with the bluetooh, the script work perfectly with the wireless but even using the patch I wasn't able to activate the bluetooth.

This start to happen after the dist-upgrade from 16.10 to 17.04 As it was suggested it try and receive the following error.

   modprobe: ERROR: could not insert 'btusb': Exec format error

The only difference is my kernel version: 4.10.0-26-generic, but as @glats suggest stop working from 4.10.0-20-generic until now.

I will appreciate any suggestion.

Pilleo commented 7 years ago

@dsapandora as always - try clean install. With some preparations it is really quick and easy.

dsapandora commented 7 years ago

@Pilleo did you suggest a clean install of the operating system or the MT7630E plugin, becuase if is for clean Install of the Ubuntu, i will just go back to 16.04 when everything was fine :dango:

Pilleo commented 7 years ago

@dsapandora ubuntu. It should be ok on 17.04 also, at least it works for me.

jeremyb31 commented 7 years ago

I am not sure what commands you are running to make the module but after you cd into the source directory do make -C /lib/modules/$(uname -r)/build M=$(pwd) clean Then do your normal commands as the exec format error usually means it was compiled with the wrong Modules.symvers file and results from modinfo btusb | egreg 'file|vermagic' Will show that the kernel version in the filename doesn't match the vermagic

dsapandora commented 7 years ago

It funny, but I just do a clean installation... of 16.04 when it was working before without an issue, and now doesn't work at all :3

dsapandora commented 7 years ago

Sorry for take me so long to response, My student where having a contest, so I was pretty busy... I follow @jeremyb31 suggestion and che the file and vermagic version and actually the kernel doesn't' match...

filename: /lib/modules/4.10.0-38-generic/kernel/drivers/bluetooth/btusb.ko vermagic: 4.10.17 SMP mod_unload

alsi i tried witht he previous kernel, with the same result

➜ modinfo btusb | grep ver

filename: /lib/modules/4.10.0-37-generic/kernel/drivers/bluetooth/btusb.ko version: 0.8 description: Generic Bluetooth USB driver ver 0.8 srcversion: E4E4EDE6D42835DE9D839FC vermagic: 4.10.17 SMP mod_unload

➜ lsmod |grep bluetooth

bluetooth 557056 10 btrtl,btintel,bnep,btbcm

➜ sudo modprobe btusb

modprobe: ERROR: could not insert 'btusb': Exec format error

Pilleo commented 7 years ago

@dsapandora this will help. Edit vermagic yourself and it will work. It did with my wifi.