вторник, 4 септември 2018 г.

How to restart wifi after suspend

My laptop seems to have a problem with one particular router that after suspend, every now and then (though not always) it will not restore the connection. It freezes on "Authenticating" and after some time, it stops trying to reconnect.
I tried restarting the module for the network:
$sudo rmmod r8169 && sudo modprobe r8169
but it didn't help.
I also tried restarting everything related to the network with:
$sudo systemctl restart *network*
Also it didn't help.
What it finally helped was:
sudo nmcli con up id #name_of_the_network --ask
After inputting the key for the Wifi network, it reconnected! YAY!
Thank you Arch community for suggesting this on one of the pages I digged trough.

понеделник, 16 юли 2018 г.

Troubleshoot the touchpad

How to compile your own driver for the touchpad:
1. Download source Sabayon
2. cd
3. Check (https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1653456)
$make mrproper 
$ cp /lib/modules/$(uname -r)/build/.config ./
$ cp /lib/modules/$(uname -r)/build/Module.symvers ./
$ make oldconfig

Find the "extraversion" of your distro ("-sabayon" in my case)

$cat /lib/modules/$(uname -r)/build/Makefile|head
# SPDX-License-Identifier: GPL-2.0
NAME = Fearless Coyote
$make EXTRAVERSION=-sabayon modules_prepare
$ make M=~/linux_elan1200_touchpad-master/
Next step might be unneeded because all you need is the hid-elan.ko to be able to load it as a module with modprobe.  
$xz ~/linux_elan1200_touchpad-master//hid-elan.ko 

How to unfreeze multitouh (careful with this cuz I had to restart once because I accidently unbinded the keyboard):
cd /sys/bus/hid/drivers/hid-multitouch
# ls
0018:04F3:3043.0007 bind module new_id uevent unbind
# echo "0018:04F3:3043.0007" | sudo tee /sys/bus/hid/drivers/hid-multitouch/unbind
# echo "0018 04F3 3043 0013" | sudo tee /sys/bus/hid/drivers/hid-multitouch/new_id

How to restart touch modules (it seems that hid-multitouch is not the one that freezes):
$lsmod|grep i2c
i2c_hid                24576  0
i2c_i801               32768  0
i2c_algo_bit           16384  2 igb,i915
$sudo rmmod i2c_hid
$sudo modprobe i2c_hid

четвъртък, 21 юни 2018 г.

nvidia howto

How to check if the system finds your adapters:
$sudo lspci | grep -i --color 'vga\|3d\|2d'
00:02.0 VGA compatible controller: Intel Corporation Device 591b (rev 04)
01:00.0 3D controller: NVIDIA Corporation GP107M [GeForce GTX 1050 Mobile] (rev a1)

Check if the two video cards work:
$optirun glxspheres

or in more details
$optirun -vv glxgears -info

To check if nvidia card is on or off?
$cat /proc/acpi/bbswitch

To turn it off
$sudo tee /proc/acpi/bbswitch <<<OFF

If it stays on:
$sudo rmmod nvidia ; sudo rmmod bbswitch

That should lead to
cat /proc/acpi/bbswitch
cat: /proc/acpi/bbswitch: no such file or directory

Then you load the driver:
$sudo modprobe bbswitch

and with
$sudo tee /proc/acpi/bbswitch <<<OFF

Now it should be OFF.

To install glxspheres and glxgears:
$sudo equo install mesa-utils
$__GL_SYNC_TO_VBLANK=0 vblank_mode=0 glxgears

To check if nvidia is running:
$nvidia-smi -a

Also to check the status of bumblebee (https://classicforum.manjaro.org/index.php?topic=2908.0):
$sudo systemctl enable bumblebeed.service
$sudo systemctl start bumblebeed.service
$sudo systemctl status bumblebeed.service

A cool way to use your NVIDIA if it's always on:
DRI_PRIME=1 glxgears
/it worked on my Maple with notable increase in calculation speed/

The file to edit for bumblebee to work properly:
$sudo nano /etc/bumblebee/xorg.conf.nvidia

How to restart nvidia if optirun gives the following error:
 [ERROR]Cannot access secondary GPU - error: [XORG] (EE) /dev/dri/card0: failed to set DRM interface version 1.4: Permission denied
$echo 1 > /sys/bus/pci/devices/0000:01:00.0/remove
$echo 1 > /sys/bus/pci/rescan

The directory where intel config resides:

Example bumblebee.conf can be found here
For extreme cases, this is how to edit the acpi tables.
A kernel patch which I haven't tested (also another one?).
Also the best Bumblebee wiki is of course the arch one.

Backlight (https://superuser.com/questions/1244145/turn-off-keyboard-backlight-when-shutting-down-linux):
Setting bumblebeed.service to start after lightdm (here and here)

A useful bbswitch command source.

options bbswitch load_state=0 unload_state=1