how to remove the alsa driver from linux kernel - linux

I have taken reference alsa driver from
https://alsa-project.org/main/index.php/Minivosc and driver code path from https://github.com/stadaki/alsa-minivosc-src .
If I, do a rmmod of aforesaid driver using below command
"rmmod snd-minivosc"
Output of the above command is
"rmmod: ERROR: Module snd_minivosc is in use"
Below is output from lsmod | grep snd-minivosc
"snd_minivosc 16384 1
snd_pcm 98304 6 snd_hda_intel,snd_hda_codec,snd_usb_audio,snd_minivosc,snd_hda_core,snd_hda_codec_hdmi
snd 81920 26
snd_hda_intel,snd_hwdep,snd_seq,snd_hda_codec,snd_usb_audio,snd_minivosc,snd_timer,snd_rawmidi,snd_hda_codec_hdmi,snd_hda_codec_generic,snd_usbmidi_lib,snd_seq_device,snd_hda_codec_realtek,snd_pcm"
Is there is any way to remove alsa driver from kernel without restarting PC?

Related

Debian 9 Dummy Output after resume from suspend (snd_hda_intel codec)

I have an external monitor that I plug-in my Dell laptop after turn it on. The sound works before and after plug it in the Laptop, So the headphone works too, plugin it in and out too. The problem is when I resume Debian after suspend. The sound has gone, and some times when increasing and decreasing volume one of the three options appears in the screen: Headphone unplugged, HDMI output (or something like), or Dummy Output.
I will show now what happens when Dummy Output is displayed and some outputs of commands.
$ lspci | grep Audio
Output:
00:1f.3 Audio device: Intel Corporation Sunrise Point-LP HD Audio (rev 21)
$ lsmod | grep hda
Output:
snd_hda_ext_core 28672 1 snd_soc_skl
snd_hda_intel 36864 0
snd_hda_codec 135168 1 snd_hda_intel
snd_hda_core 90112 4 snd_hda_intel,snd_hda_codec,snd_hda_ext_core,snd_soc_skl
snd_hwdep 16384 1 snd_hda_codec
snd_pcm 110592 6 snd_hda_intel,snd_hda_codec,snd_hda_ext_core,snd_hda_core,snd_soc_skl,snd_soc_core
snd 86016 7 snd_compress,snd_hda_intel,snd_hwdep,snd_hda_codec,snd_timer,snd_soc_core,snd_pcm
$ sudo dmesg | grep snd
Output (when rebooting):
[ 13.341580] snd_hda_intel 0000:00:1f.3: bound 0000:00:02.0 (ops i915_audio_component_bind_ops [i915])
[ 13.461226] snd_hda_intel 0000:00:1f.3: CORB reset timeout#1, CORBRP = 0
[ 13.462799] snd_hda_intel 0000:00:1f.3: no codecs found!
$ sudo alsactl init
Output:
alsactl: init:1757: No soundcards found...
Complete Alsa Information script:
https://alsa-project.org/db/?f=ff03c7d8dac369fc1211822de963b337c132420c
So it looks like the sound card is there but alsa does not recognize it.
Many forums/sites recommend to blacklist snd_hda_codec_hdmi (that would be the case when the problem is with connecting/desconnecting HDMI for the external monitor), and also put a line:
options snd-hda-intel model=generic
in a file, e.g., /etc/modprobe.d/alsa-base-blacklist.conf.
But it didn't work.
Other sites suggest to disable and enable sound in BIOS. Didn't work.
Can anyone help me solve this forever issue?

tinkerboard android - /sys/class/thermal/thermal_zone1/temp: No such file or directory

I am using a tinkerboard with an android + chroot linux. When I try to read temperature by the following command:
cat /sys/class/thermal/thermal_zone1/temp
I get the following error :
cat: /sys/class/thermal/thermal_zone1/temp: No such file or directory
If I run the tinkerboard directly with a linux distribution rather than android I am able to read the temperature by the above command.
The tinkerboard uses the RK3288 cpu which has a TS-ADC temperature sensor.
Any suggestions?
lsmod - linux:
Module Size Used by
fuse 94208 3
snd_soc_hdmi_codec 16384 1
mali_kbase 335872 0
dw_hdmi_i2s_audio 16384 0
rk_crypto 24576 0
dw_wdt 16384 0
syscon_reboot_mode 16384 0
reboot_mode 16384 1 syscon_reboot_mode
r8723bs 544768 0
zram 20480 5
ip_tables 20480 0
autofs4 28672 0
lsmod - android ( linux chroot ):
Module Size Used by
After some research by my colleague:
The kernel was missing the required drivers. Fortunately the newest updates to the kernel included the thermal sensor. It now works.

Setting GPIO using sysfs fails in i.MX6

I have a custom i.MX6 board, and I want to turn on a particular GPIO.
From the schematic, the GPIO pin is connected to KEY_COL2 pad, and the KEY_COL2 has the following options.
So, I have to export the following GPIO as per the calculation:
linux gpio number = (gpio_bank - 1) * 32 + gpio_bit
gpio number = ( 4 - 1 ) *32 +10 = 106
When I run the following command, i get the error:
# echo 106 > /sys/class/gpio/export
sh: write error: Device or resource busy
What can be the issue, am i missing anything...
After looking at the device tree, this particular GPIO was used by some other device, hence the error.
You can find the GPIO's in use with the following commands:
mount -t debugfs none /sys/kernel/debug
cat /sys/kernel/debug/gpio

Mount USB device on router - OpenWrt

I am new to OpenWrt and Linux/Unix shell. Prior to this, was using dd-wrt for 2 years. Recently switched to OpenWrt and got the basic setup done(wifi/internet working). I need to install transmission my router. But, USB device won't mount.
The Details of the router are as follows:
Router Model:
Asus RT-N13U B1
Image flashed:
chaos_calmer 15.05.1 (openwrt-15.05.1-ramips-rt305x-rt-n13u-squashfs-sysupgrade.bin)
Usb Details:
Crusier Blade 16GB usb 2.0
Formatted to ext4 using GParted bootable cd
Drivers Installed:
kmod-usb-core(preinstalled)
kmod-usb-dwc2(preinstalled)
kmod-usb2
kmod-usb-storage
kmod-fs-ext4
kmod-scsi-core(preinstalled)
Here are permissions for dev/sda, /dev/sda1 and /mnt (set 777 manually):
~#ls -l /dev
brwxrwxrwx 1 root root 8, 0 Jan 17 21:56 sda
brwxrwxrwx 1 root root 8, 1 Jan 17 21:56 sda1
~#ls -l ..
drwxrwxrwx 2 root root 0 Jan 16 21:28 mnt
Error while mounting:
~# mount -t ext4 /dev/sda1 /mnt
mount: mounting /dev/sda1 on /mnt failed: No such file or directory
echo $?
255
sda1 is present inside dev and /mnt directory exists. Still it shows an error.
I have tried installing/reinstalling and then mounting, but for the same result. Also when I disconnect the USB sda and sda1 folders disappear and then reappear when USB is reconnected so I guess the device is being detected successfully.
What is it, that I am missing?
Edit:
Added edits as suggested in the comments.
dmesg output (The output is very big so linked it)
Edit 2:
Switched to LEDE 17. Is more stable and have had zero issues in the past week.
the critical part of the dmesg output is
[ 9.410000] mount_root: loading kmods from internal overlay
[ 9.940000] SCSI subsystem initialized
[ 9.960000] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 9.980000] ehci-platform:EHCI generic platform driver [ 9.990000] usb-storage 1-1:1.0: no of_node; not parsing pinctrl DT
[ 9.990000] usb-storage 1-1:1.0: USB Mass Storage device detected
[ 10.010000] scsi host0: usb-storage 1-1:1.0
[ 10.020000] usbcore: registered new interface driver usb-storage
[ 10.100000] block: attempting to load /tmp/jffs_cfg/upper/etc/config/fstab
[ 10.120000] block: extroot: not configured
[ 10.130000] mount_root: switching to jffs2 overlay
[ 10.180000] procd: - early -
[ 11.020000] scsi 0:0:0:0: Direct-Access SanDisk Cruzer Blade 1.27 PQ: 0 ANSI: 6
[ 11.030000] sd 0:0:0:0: no of_node; not parsing pinctrl DT
[ 11.050000] sd 0:0:0:0: [sda] 30529536 512-byte logical blocks: (15.6 GB/14.5 GiB)
[ 11.070000] sd 0:0:0:0: [sda] Write Protect is off
[ 11.070000] sd 0:0:0:0: [sda] Mode Sense: 43 00 00 00
[ 11.090000] sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[ 11.120000] sda: sda1
[ 11.130000] sd 0:0:0:0: [sda] Attached SCSI removable disk
[ 11.550000] EXT4-fs (sda1): Cannot load crc32c driver
oh no, this seems to be a bug
Bug#819725: ext4 missing softdep on crc32c module
https://lists.debian.org/debian-kernel/2016/04/msg00013.html
the following workaround is not applicable because initramfs is a native file system at startup time (https://en.wikipedia.org/wiki/Initramfs) and has no influence when the system is fully up (rootfs is mounted):
Until this is fixed in the kernel package, you can work around it by
either:
Setting base-installer/initramfs-tools/driver-policy to "most" instead of "dep"
Setting base-config/late_command to a script that adds crc32c to /etc/initramfs-tools/modules
post the stack trace anyway, maybe there is another workaround
this is overcomplicated stuff...
here is maybe a solution https://forum.openwrt.org/viewtopic.php?id=69175
download kmod-lib-crc32c and kmod-crypto-crc32c
if this is not working maybe the easiest solution is to format the USB stack as VFAT and to wait for a new kernel...
this is not a permissions error. a permission error would return EPERM -> error code 1 Operation not permitted
it would be interesting to know what exit code the mount returns. The 'exit behavior is very different in the several mount version' i.e. mount(2) and mount(8)
for getting the return value, type in a shell the command
mount /dev/sda1 /mnt
then
echo $?
the number is the returned exit code of the mount (the 255 means 'exit status out of range' in this case '-1', http://www.tldp.org/LDP/abs/html/exitcodes.html#EXITCODESREF)
a listing of the mount(8) exit codes is i.e. in http://www.stackoverflow.com/questions/33167585/what-are-the-return-codes-values-of-linux-umount
http://www.becane.com/2014/09/02/understanding-exit-codes-and-how-to-use-them-in-a-bash-script
beside the return value mount(2) also sets an error code in errno (http://man7.org/linux/man-pages/man3/errno.3.html). printing errno in shell is a bit difficult it is easier to get a reference like http://www-numi.fnal.gov/offline_software/srt_public_context/WebDocs/Errors/unix_system_errors.html and search for the error string, in this case No such file or directory
the string No such file or directory is system error ENOENT
As a system error ENOENT means A pathname was empty or had a nonexistent component. (http://man7.org/linux/man-pages/man2/mount.2.html)
try sudo mount -t ext4 /dev/sda1 /mnt because the stick is formatted in ext4
if this is not working dmesg output would be interesting
detach usb device, reattach usb device, type dmesg and see the output. in the output of dmesg you also see which drivers are loaded for the device
https://wiki.openwrt.org/doc/howto/usb.storage says that you need several more drivers (block-mount, kmod-scsi-core,...) because a usb stick (USB Mass Storage class) is also a SCSI and a block device...
(linux system error codes are in http://www-numi.fnal.gov/offline_software/srt_public_context/WebDocs/Errors/unix_system_errors.html)
print a stack trace sudo strace -f mount -t ext4 -o default /dev/sda1 /mnt and post it

writing in /sys/bus/pci/... fails

Attempt to run the following command with root privilege on kernel 2.6.35 results in error:
% echo 0000:00:03.0 > /sys/bus/pci/drivers/foo/bind
-bash: echo: write error: No such device
UPDATE
The device does exist in /sys/bus/pci/devices/ the output of lspci is as follows:
% lspci -v -s 0000:00:03.0
00:03.0 Ethernet controller: Intel Corporation 82540EM Gigabit Ethernet Controller (rev 02)
Subsystem: Intel Corporation PRO/1000 MT Desktop Adapter
Flags: bus master, 66MHz, medium devsel, latency 64, IRQ 10
Memory at f0000000 (32-bit, non-prefetchable) [size=128K]
I/O ports at d010 [size=8]
Capabilities: <access denied>
Kernel driver in use: e1000
I think I resolved the issue. It appears that the driver requires to unbind device at first.
It also appears that the shell processes redirection (echo .. > /sys/bus/..) with user permission, and 'sudo' handles only the command, i.e. 'echo' but not the whole command line that follows it, therefore it has to be executed this way:
% sudo sh -c "echo 0000:00:03.0 > /sys/bus/pci/drivers/foo/unbind"
% sudo sh -c "echo 0000:00:03.0 > /sys/bus/pci/drivers/foo_new/bind"

Resources