WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: [Solved] is there support for Ralink RT5370 chipset in TCL?  (Read 1974 times)

Offline GNUser

  • Hero Member
  • *****
  • Posts: 846
[Solved] is there support for Ralink RT5370 chipset in TCL?
« on: November 28, 2021, 10:25:06 AM »
I'm considering getting this device for my wireless router, which is powered by TCL11 x86_64:
https://www.amazon.ca/gp/product/B01KWQAQ00

The device uses the Ralink RT5370 chipset, which apparently on GNU/Linux is supported by the rt2800usb driver (per https://wiki.debian.org/rt2800usb).

wireless-KERNEL.tcz provides rt2800usb.ko.gz but firmware-ralinkwifi.tcz does not seem to contain any relevant firmware. I've seen situations where a relevant kernel module exists but it can't do what it needs to do unless the appropriate firmware is also present on the system.

My question is simple: Is the device I'm considering, which uses the Ralink RT5370 chipset, supported on TCL11 x86_64?
« Last Edit: November 29, 2021, 12:08:12 PM by Rich »

Offline GNUser

  • Hero Member
  • *****
  • Posts: 846
Re: is there support for Ralink RT5370 chipset in TCL?
« Reply #1 on: November 28, 2021, 10:40:25 AM »
This table says that the rt2800usb kernel module requires non-free firmware:
https://en.wikipedia.org/wiki/Comparison_of_open-source_wireless_drivers

Does the firmware need to be loaded by the user, or does stock kernel itself already contain the firmware? I guess it's also possible that the device itself contains the needed firmware. Please pardon my ignorance.
« Last Edit: November 28, 2021, 10:42:47 AM by GNUser »

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10661
Re: is there support for Ralink RT5370 chipset in TCL?
« Reply #2 on: November 29, 2021, 12:14:20 AM »
The kernel doesn't contain firmware, and most devices don't contain it to save money. So it's in most cases external.

Unless someone with such a device chimes in, here's how you can check:
- look up the usb id
- in the 2800usb sources, there will be a mapping from the id to required firmware

You can probably get it to work, but may require downloading firmware or customizing the kernel. Atheros wireless cards are a bit more expensive, but they tend to have good support.
The only barriers that can stop you are the ones you create yourself.

Offline GNUser

  • Hero Member
  • *****
  • Posts: 846
Re: is there support for Ralink RT5370 chipset in TCL?
« Reply #3 on: November 29, 2021, 06:41:19 AM »
The kernel doesn't contain firmware, and most devices don't contain it to save money. So it's in most cases external.
Thank you, curaga. Good to know. When the firmware is free (as in freedom), is it contained in the kernel module then? Because in my experience, free software-friendly peripherals almost never require downloading any firmware.

I did a bit more research. Someone mentioned here that the firmware for the RT5370 chipset is rt2870.bin. So it seems that if I load wireless-KERNEL.tcz (which contains the driver, rt2800usb.ko.gz) and firmware-ralinkwifi.tcz (which contains the firmware, rt2870.bin) this thing should work. (It's frustrating how none of the numbers match--RT5370, rt2800usb, rt2870. Oh, well. It seems very few things in life are as simple as one would expect.) I'll order this thing and will add a reply once I've had a chance to test it out.

P.S. I much prefer Atheros chipsets because they do not require anything proprietary to work. However, USB wireless adapters with Atheros chipsets support only 7-8 clients when used in AP mode (I know this from years of living with this limitation). Supposedly, USB wireless adapters with the RT5370 chipset are able to handle 20+ clients in AP mode.
« Last Edit: November 29, 2021, 06:47:49 AM by GNUser »

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 10150
Re: is there support for Ralink RT5370 chipset in TCL?
« Reply #4 on: November 29, 2021, 07:30:44 AM »
Hi GNUser
... the firmware for the RT5370 chipset is rt2870.bin. ...
I don't remember where, but I stumbled across a similar statement.

... - look up the usb id ...
According to this:
https://wireless.wiki.kernel.org/en/users/drivers/rt2800usb/devices
the usb id is  0x148f:0x5370.

Since I had them handy, I checked this Kconfig in the TC10 kernel sources:
kernel64/linux-4.19.10/drivers/net/wireless/ralink/rt2x00/Kconfig

It listed this option:
Code: [Select]
config RT2800USB_RT53XX
       bool "rt2800usb - Include support for rt53xx devices (EXPERIMENTAL)"
       ---help---
         This adds support for rt53xx wireless chipset family to the
         rt2800usb driver.
         Supported chips: RT5370

Then checking the kernel config for  TCL11 x86_64  here:
http://tinycorelinux.net/11.x/x86_64/release/src/kernel/config-5.4.3-tinycore64

it shows:
Code: [Select]
# CONFIG_RT2800USB_RT53XX is not setwhich means support for RT5370 is not enabled for that kernel.

Offline GNUser

  • Hero Member
  • *****
  • Posts: 846
Re: is there support for Ralink RT5370 chipset in TCL?
« Reply #5 on: November 29, 2021, 08:09:28 AM »
Rich, you are always so helpful. Thank you. You saved me a headache.
I will recompile the kernel while I wait for this device to arrive, with that config option enabled.
« Last Edit: November 29, 2021, 08:27:35 AM by GNUser »

Offline GNUser

  • Hero Member
  • *****
  • Posts: 846
Re: is there support for Ralink RT5370 chipset in TCL?
« Reply #6 on: November 29, 2021, 08:14:08 AM »
I found this nearby, which seems similar to what I need:
Code: [Select]
CONFIG_RT2800USB_RT33XX=y
so I'm going to go with this:
Code: [Select]
CONFIG_RT2800USB_RT53XX=y

« Last Edit: November 29, 2021, 08:22:48 AM by GNUser »

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10661
Re: is there support for Ralink RT5370 chipset in TCL?
« Reply #7 on: November 29, 2021, 09:55:56 AM »
Thank you, curaga. Good to know. When the firmware is free (as in freedom), is it contained in the kernel module then? Because in my experience, free software-friendly peripherals almost never require downloading any firmware.
It rarely is included in the sources, since when it's external, it's easier to update it. The peripherals you mention most likely have it internally.
The only barriers that can stop you are the ones you create yourself.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 10150
Re: is there support for Ralink RT5370 chipset in TCL?
« Reply #8 on: November 29, 2021, 10:05:45 AM »
Hi GNUser
Yes, that is the correct setting.

In case you are not aware, kernel config files are not intended to be edited directly. Options can interact. Use the command:
Code: [Select]
make menuconfigto make changes.

Offline GNUser

  • Hero Member
  • *****
  • Posts: 846
Re: is there support for Ralink RT5370 chipset in TCL?
« Reply #9 on: November 29, 2021, 10:22:53 AM »
Thanks, Rich. I know. But things are so hard to find in the menu with all the nesting.

Do you have any tricks on how to find things in the kernel configuration menu (for example, where to find the checkbox that corresponds to CONFIG_RT2800USB_RT53XX)?

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 10150
Re: is there support for Ralink RT5370 chipset in TCL?
« Reply #10 on: November 29, 2021, 10:35:18 AM »
Hi GNUser
Simple. Once the  menuconfig  menu is up, press  /  to call up the (case insensitive) search dialog. Then enter:
Code: [Select]
rt53xxYou should see 2 items come up, the PCI and the USB versions. Enter  2  to select the second one (USB) and
it will take you to the correct menu section.

Offline GNUser

  • Hero Member
  • *****
  • Posts: 846
Re: is there support for Ralink RT5370 chipset in TCL?
« Reply #11 on: November 29, 2021, 11:36:47 AM »
NICE! What a killer trick!

Thank you both so much for all your help and for helping me become a better user/hacker :)

Thread may definitely be marked as solved!

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 10150
Re: [Solved] is there support for Ralink RT5370 chipset in TCL?
« Reply #12 on: November 29, 2021, 12:11:38 PM »
Hi GNUser
... Thread may definitely be marked as solved!
As you wish.  :)

Offline GNUser

  • Hero Member
  • *****
  • Posts: 846
Re: [Solved] is there support for Ralink RT5370 chipset in TCL?
« Reply #13 on: December 02, 2021, 04:51:06 PM »
Just a quick follow-up. Loading the two relevant extensions (wireless-KERNEL.tcz and firmware-ralink.tcz) and using custom kernel (compiled with CONFIG_RT2800USB_RT53XX=y) did not do the trick. It turns out that the  rt2800usb  kernel module supplied with  wireless-KERNEL.tcz  does not support the device. I discovered this because this command did not return anything:
Code: [Select]
$ modinfo rt2800usb | grep 5370
When the kernel module supports this chipset, this is what you should see:
Code: [Select]
$ modinfo rt2800usb | grep 5370
alias:          usb:v148Fp5370d*dc*dsc*dp*ic*isc*ip*in*

The solution was to compile the ralink kernel modules and rebuild  wireless-KERNEL.tcz  extension with the new modules.

Here are the steps I took in case it ever helps anyone:

Code: [Select]
1. Download linux-5.4.3-patched.txz and config-5.4.3-tinycore64 from here:
       http://tinycorelinux.net/11.x/x86_64/release/src/kernel/
2. In the config file, change the "# CONFIG_RT2800USB_RT53XX not set" line to this:
       CONFIG_RT2800USB_RT53XX=y
3. Extract the .txz archive so that ~/Downloads now contains linux-5.4.3 directory
4. Follow these steps:
$ tce-load -i compiletc perl5 bash ncursesw-dev bc glibc_apps elfutils-dev
$ cd ~/Downloads/linux-5.4.3
$ cp ../config-5.4.3-tinycore64 ./.config
$ make oldconfig
$ make bzImage # this compiles the kernel image, but go ahead and skip this step bc all we need are some modules
$ make M=drivers/net/wireless/ralink/rt2x00 modules # this creates the kernel modules you need
The payload will the the files ~/Downloads/linux-5.4.3/drivers/net/wireless/ralink/rt2x00/rt*.ko
Now you have to unsquashfs the  wireless-KERNEL.tcz  extension, replace all the *.ko.gz files in  its  /usr/local/lib/modules/5.4.3-tinycore64/kernel/drivers/net/wireless/ralink/rt2x00  directory with the rt*.ko files that you just compiled, then recreate the extension with mksquashfs.

Now it works. Phew!

To summarize: To use a device with the RT5370 chipset in TCL, you need 2 things:
1. Custom wireless-KERNEL.tcz extension (containing ralink kernel modules compiled with the CONFIG_RT2800USB_RT53XX=y option)
2. The firmware-ralinkwifi.tcz extension

None of this would have been possible without curaga and Rich's help. I wish I could buy you guys a beer.

EDIT: I tested things with stock kernel and with custom kernel. It worked both ways, so it turns out that custom kernel is not necessary. All we need is for the kernel module to support the device and for the firmware to be available.
« Last Edit: December 02, 2021, 05:13:26 PM by GNUser »

Offline GNUser

  • Hero Member
  • *****
  • Posts: 846
Re: [Solved] is there support for Ralink RT5370 chipset in TCL?
« Reply #14 on: December 02, 2021, 05:51:58 PM »
curaga,

So it turns out that TCL almost supports the RT5370 chipset out of the box: It is supported by the kernel, the firmware (rt2870.bin) is provided as an extension, and the necessary kernel module (rt2800usb) is also provided as an extension. The only fly in the ointment is that the kernel module doesn't work with this chipset unless the module is compiled with the CONFIG_RT2800USB_RT53XX=y option.

In future versions of TCL, would it be possible for the rt2800usb kernel module inside wireless-KERNEL.tcz to be compiled with the CONFIG_RT2800USB_RT53XX=y option so that RT5370 is fully supported?

For folks who use a TCL box as a wireless router, this chipset is important because it supports a lot of clients when in AP mode.

refs:
https://github.com/raspberrypi/linux/issues/3010
https://raspberrypi.stackexchange.com/questions/50162/maximum-wi-fi-clients-on-pi-3-hotspot/117999#117999
« Last Edit: December 02, 2021, 05:57:09 PM by GNUser »