Skip to content

Instantly share code, notes, and snippets.

View colerd24's full-sized avatar

RC-Friedrich colerd24

View GitHub Profile
1) Install necessary dependencies:
Raspberry Pi: raspberrypi-kernel-headers
Ubuntu: build-essential linux-headers-`uname -r`
2) Create build directory:
mkdir ~/lkm_test
cd ~/lkm_test
3) Create example lkm_test.c file:
#include <linux/init.h>
@colerd24
colerd24 / BME280
Last active October 26, 2019 23:41
Product: https://www.adafruit.com/product/2652
SPI Overlay: https://raspberrypi.stackexchange.com/questions/66718/how-to-use-bmp280-spi-kernel-module
Use the i2c-sensor builtin overlay:
dtparam=i2c_arm=on
dtoverlay=i2c-sensor,bme280,addr=0x77
/sys/bus/i2c/devices/i2c-1/1-0077/iio:device0
https://hackaday.com/2019/10/17/worn-out-emmc-chips-are-crippling-older-teslas/
hp_accel: Interface to HP ACPI BIOS for LIS3LV02DL accelerometer
Raw values: cat /sys/devices/platform/lis31v02d/position
Other stuff: /sys/devices/platform/lis3lv02d/input/input26
Test using jstest-gtk (joystick test)
evtest /dev/input/event6
https://thehackerdiary.wordpress.com/2017/04/21/exploring-devinput-1/
User modifiable LEDs Linux Path:
/sys/class/leds/
Linux Drivers Source Files:
https://github.com/torvalds/linux/tree/master/drivers/leds
Turn on/off (where x is 1 or 0):
echo x | sudo tee "/sys/class/leds/led_name/brightness" # or "brightness" if relative
Triggers:
Diet Pi has some good information
https://docs.google.com/spreadsheets/d/1mDHGZC-H6tU6_O8kuLTG8d4A8Nt7lV1Q7MXTR_6qw30/edit#gid=0
Throttling:
Change soft and firm temperature limits? (soft limit will underclock, how much on CM3+? It is 1.4->1.2 on 3B+)
In config.txt
temp_limit=X (default 85C)
If overclocked, sets default clocks if value is exceeded
temp_soft_limit=X (default 60C)
Sets temp when clock is throttled if value is met, 1.4GHz to 1.2GHz on 3B+ (what does it do on CM3+?)