Circuit-Sword Buster + updated kernel + DKMS wifi module + Bluetooth

davomat
Posts: 13
Joined: Wed Oct 18, 2017 7:11 am
Has thanked: 2 times
Been thanked: 6 times

Re: Circuit-Sword Buster + updated kernel + DKMS wifi module + Bluetooth

Post by davomat » Fri Apr 15, 2022 4:48 pm

I had the exact same problem that the volume is too loud on my Circuit Shields. While on Stretch everything was fine, on Buster the volume is at max. So, I flashed the 2 images (Stretch and Buster) and compared the outputs of amixer and dmesg:

Stretch:
amixer-stretch.png
amixer-stretch.png (129.65 KiB) Viewed 1612 times
dmesg-stretch.png
dmesg-stretch.png (120.22 KiB) Viewed 1612 times
Buster:
amixer-buster.png
amixer-buster.png (117.66 KiB) Viewed 1612 times
dmesg-buster.png
dmesg-buster.png (109.55 KiB) Viewed 1612 times
As you can see, there is a difference in the volume range (Stretch: 0-9472 vs. Buster: 0-255) so that on Buster the volume can be decreased only by 1dB. On Buster now there is also some obscure message saying "set volume quirk for CM102-A+/1025+". Searching for it quickly reveals the cause of the volume difference here:
https://github.com/torvalds/linux/commi ... 4639c4caff

It seems someone wanted to fix a volume problem, but introduced another one which is now in the linux kernel driver for the CM102-A+/102S+ USB audio controller:
https://github.com/torvalds/linux/blob/ ... er.c#L1139

Long story short, I could fix the volume problem on Buster locally by reverting that change in the kernel and recompiling it directly on the Raspberry. I simply followed the guide here:
https://www.raspberrypi.com/documentati ... tml#kernel

I tried to create a DKMS module to replace the snd-usb-audio module of the kernel with my patched one, but am struggling here. Maybe someone with more DKMS experience can help? The reverse kernel patch is the following:

Update: I was now able to create a DKMS module following the example of @Anthology, so now everyone can fix their loud sounds themselves following the README here:
https://github.com/weese/Circuit-Sword/ ... und-module
SpoilerShow

Code: Select all

diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index bb5ab7a7dfa5..344d7b069d59 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -967,6 +967,14 @@ static void volume_control_quirks(struct usb_mixer_elem_info *cval,
 		}
 		break;
 
-	
):
-		if (!strcmp(kctl->id.name, "PCM Playback Volume")) {
-			usb_audio_info(chip,
-				 "set volume quirk for CM102-A+/102S+\n");
-			cval->min = -256;
-		}
-		break;
-
 	case USB_ID(0x0471, 0x0101):
 	case USB_ID(0x0471, 0x0104):
 	case USB_ID(0x0471, 0x0105):

hurricane
Posts: 15
Joined: Thu Feb 28, 2019 7:06 pm
Has thanked: 7 times
Been thanked: 1 time

Re: Circuit-Sword Buster + updated kernel + DKMS wifi module + Bluetooth

Post by hurricane » Mon Apr 18, 2022 10:01 am

davomat wrote:
Fri Apr 15, 2022 4:48 pm
I had the exact same problem that the volume is too loud on my Circuit Shields. While on Stretch everything was fine, on Buster the volume is at max. So, I flashed the 2 images (Stretch and Buster) and compared the outputs of amixer and dmesg:

Stretch:
amixer-stretch.png
dmesg-stretch.png

Buster:
amixer-buster.png
dmesg-buster.png

As you can see, there is a difference in the volume range (Stretch: 0-9472 vs. Buster: 0-255) so that on Buster the volume can be decreased only by 1dB. On Buster now there is also some obscure message saying "set volume quirk for CM102-A+/1025+". Searching for it quickly reveals the cause of the volume difference here:
https://github.com/torvalds/linux/commi ... 4639c4caff

It seems someone wanted to fix a volume problem, but introduced another one which is now in the linux kernel driver for the CM102-A+/102S+ USB audio controller:
https://github.com/torvalds/linux/blob/ ... er.c#L1139

Long story short, I could fix the volume problem on Buster locally by reverting that change in the kernel and recompiling it directly on the Raspberry. I simply followed the guide here:
https://www.raspberrypi.com/documentati ... tml#kernel

I tried to create a DKMS module to replace the snd-usb-audio module of the kernel with my patched one, but am struggling here. Maybe someone with more DKMS experience can help? The reverse kernel patch is the following:

Update: I was now able to create a DKMS module following the example of @Anthology, so now everyone can fix their loud sounds themselves following the README here:
https://github.com/weese/Circuit-Sword/ ... und-module
SpoilerShow

Code: Select all

diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index bb5ab7a7dfa5..344d7b069d59 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -967,6 +967,14 @@ static void volume_control_quirks(struct usb_mixer_elem_info *cval,
 		}
 		break;
 
-	
):
-		if (!strcmp(kctl->id.name, "PCM Playback Volume")) {
-			usb_audio_info(chip,
-				 "set volume quirk for CM102-A+/102S+\n");
-			cval->min = -256;
-		}
-		break;
-
 	case USB_ID(0x0471, 0x0101):
 	case USB_ID(0x0471, 0x0104):
 	case USB_ID(0x0471, 0x0105):
Unfortunately this fix does not seem to be working for me. I tried the various methods and I keep getting error messages in the terminal. Is there any way this fix can be implemented into anthology's file for a clean issue free download for everyone? Thanks for all your work.

davomat
Posts: 13
Joined: Wed Oct 18, 2017 7:11 am
Has thanked: 2 times
Been thanked: 6 times

Re: Circuit-Sword Buster + updated kernel + DKMS wifi module + Bluetooth

Post by davomat » Mon Apr 18, 2022 10:46 am

Unfortunately this fix does not seem to be working for me. I tried the various methods and I keep getting error messages in the terminal. Is there any way this fix can be implemented into anthology's file for a clean issue free download for everyone? Thanks for all your work.
Can you post exactly what you tried and what error messages you get? in the meantime I’m trying to set up exactly that flashable image based on the latest Retropie version, but am still fighting with errors.

hurricane
Posts: 15
Joined: Thu Feb 28, 2019 7:06 pm
Has thanked: 7 times
Been thanked: 1 time

Re: Circuit-Sword Buster + updated kernel + DKMS wifi module + Bluetooth

Post by hurricane » Mon Apr 18, 2022 6:18 pm

davomat wrote:
Mon Apr 18, 2022 10:46 am
Unfortunately this fix does not seem to be working for me. I tried the various methods and I keep getting error messages in the terminal. Is there any way this fix can be implemented into anthology's file for a clean issue free download for everyone? Thanks for all your work.
Can you post exactly what you tried and what error messages you get? in the meantime I’m trying to set up exactly that flashable image based on the latest Retropie version, but am still fighting with errors.
Here are my results from the readme to install the updates using the dkms. Hope this helps. If I am an idiot and I screwed it up myself, I apologize.
Image
Attachments
Capture1.JPG
Capture1.JPG (175.11 KiB) Viewed 1560 times

davomat
Posts: 13
Joined: Wed Oct 18, 2017 7:11 am
Has thanked: 2 times
Been thanked: 6 times

Re: Circuit-Sword Buster + updated kernel + DKMS wifi module + Bluetooth

Post by davomat » Tue Apr 19, 2022 1:31 am

hurricane wrote:
Mon Apr 18, 2022 6:18 pm
Here are my results from the readme to install the updates using the dkms. Hope this helps. If I am an idiot and I screwed it up myself, I apologize.
I see. You need to download the file snd-usb-audio-dkms_0.1_armhf.deb manually from the repo into your directory. The README wasn't clear enough there. So, the following should do the trick:

Code: Select all

apt-get install wget
wget https://github.com/weese/Circuit-Sword/raw/master/sound-module/snd-usb-audio-dkms_0.1_armhf.deb
sudo dpkg -i snd-usb-audio-dkms_0.1_armhf.deb

hurricane
Posts: 15
Joined: Thu Feb 28, 2019 7:06 pm
Has thanked: 7 times
Been thanked: 1 time

Re: Circuit-Sword Buster + updated kernel + DKMS wifi module + Bluetooth

Post by hurricane » Tue Apr 19, 2022 1:37 pm

davomat wrote:
Tue Apr 19, 2022 1:31 am
hurricane wrote:
Mon Apr 18, 2022 6:18 pm
Here are my results from the readme to install the updates using the dkms. Hope this helps. If I am an idiot and I screwed it up myself, I apologize.
I see. You need to download the file snd-usb-audio-dkms_0.1_armhf.deb manually from the repo into your directory. The README wasn't clear enough there. So, the following should do the trick:

Code: Select all

apt-get install wget
wget https://github.com/weese/Circuit-Sword/raw/master/sound-module/snd-usb-audio-dkms_0.1_armhf.deb
sudo dpkg -i snd-usb-audio-dkms_0.1_armhf.deb
So I run this command first, then line 3 command, then line 4 command? The lines I am referencing are in the readme. I guess I am assuming that line 2 means to run line 9, 13, 19, or 22 first? Sorry to bother you, I am usually a lot better at updating and programming than this..........

davomat
Posts: 13
Joined: Wed Oct 18, 2017 7:11 am
Has thanked: 2 times
Been thanked: 6 times

Re: Circuit-Sword Buster + updated kernel + DKMS wifi module + Bluetooth

Post by davomat » Tue Apr 19, 2022 3:00 pm

hurricane wrote:
Tue Apr 19, 2022 1:37 pm
So I run this command first, then line 3 command, then line 4 command? The lines I am referencing are in the readme. I guess I am assuming that line 2 means to run line 9, 13, 19, or 22 first? Sorry to bother you, I am usually a lot better at updating and programming than this..........
Ok, I've realised that I invested too little time in updating the README. I mostly copied it from Wifi module but forgot that on your Pi the Circuit-Sword folder doesn't contain the sound-module folder yet. Now, I tried to clean it up and described the 3 options you have and where to download the folder or deb package from. You should try them top to bottom until you have a reasonable audio volume again:
https://github.com/weese/Circuit-Sword/ ... /README.md

davomat
Posts: 13
Joined: Wed Oct 18, 2017 7:11 am
Has thanked: 2 times
Been thanked: 6 times

Re: Circuit-Sword Buster + updated kernel + DKMS wifi module + Bluetooth

Post by davomat » Wed Apr 20, 2022 4:17 am

hurricane wrote:
Mon Apr 18, 2022 10:01 am
Unfortunately this fix does not seem to be working for me. I tried the various methods and I keep getting error messages in the terminal. Is there any way this fix can be implemented into anthology's file for a clean issue free download for everyone? Thanks for all your work.
I've finally managed to build a running release myself using Docker on my Mac (more info here). It is based on Anthology's image and includes the audio fix. There you go:

Circuit Sword Software version 1.4.0
  • Updated Wi-Fi ROM + kernel + Bluetooth (thanks to Anthology)
  • Fixed volume issue
  • DKMS modules for Wi-Fi and snd-usb-audio (to survive Linux kernel upgrades)
  • based on RetroPie 4.7.1, Raspbian kernel 5.10.103
Go to Downloads

hurricane
Posts: 15
Joined: Thu Feb 28, 2019 7:06 pm
Has thanked: 7 times
Been thanked: 1 time

Re: Circuit-Sword Buster + updated kernel + DKMS wifi module + Bluetooth

Post by hurricane » Wed Apr 20, 2022 1:49 pm

davomat wrote:
Wed Apr 20, 2022 4:17 am
hurricane wrote:
Mon Apr 18, 2022 10:01 am
Unfortunately this fix does not seem to be working for me. I tried the various methods and I keep getting error messages in the terminal. Is there any way this fix can be implemented into anthology's file for a clean issue free download for everyone? Thanks for all your work.
I've finally managed to build a running release myself using Docker on my Mac (more info here). It is based on Anthology's image and includes the audio fix. There you go:

Circuit Sword Software version 1.4.0
  • Updated Wi-Fi ROM + kernel + Bluetooth (thanks to Anthology)
  • Fixed volume issue
  • DKMS modules for Wi-Fi and snd-usb-audio (to survive Linux kernel upgrades)
  • based on RetroPie 4.7.1, Raspbian kernel 5.10.103
Go to Downloads
You sir are a GENIUS! Thank you so much for your help and dedication to the community. I finally have volume!

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest