Skip to content

Instantly share code, notes, and snippets.

View shenghaoyang's full-sized avatar
🦪

Shenghao Yang shenghaoyang

🦪
View GitHub Profile
@shenghaoyang
shenghaoyang / tsc_constants.c
Last active May 21, 2023 14:44
hacky code to get tsc -> ns conversion factors from the kernel - see https://github.com/shenghaoyang/get_tsc_coeff instead
/**
* Reads the TSC conversion factors from the kernel, used to convert
* TSC ticks into nanoseconds with respect to the frequency \c CLOCK_MONOTONIC
* is running at.
*
* Works on Kernel 6.3.3, x86_64, without time namespacing.
*
* Absolutely no guarantees that the values provided are accurate on other
* kernel versions - it depends heavily on private implementation details.
*
@shenghaoyang
shenghaoyang / Windows11VM.md
Created December 17, 2022 12:22
Windows 11 VM with GPU passthrough on Fedora 37

Virtualized Windows 11 with GPU passthrough

Setup of a virtualized instance of Windows 11 on a Fedora 37 host.

Hardware

@shenghaoyang
shenghaoyang / stm32cube-upstream-openocd.md
Last active February 11, 2022 10:26
STM32CubeIDE with upstream OpenOCD

(latest versions of?) STM32CubeIDE seems to send DAP-related monitor commands:

ReadAP, WriteAP, ReadDP, WriteDP

Upstream OpenOCD (at least the one that is packaged in Fedora) implements the functionality of those commands but they are not available under those names.

Copy mon_cmd_extension.cfg's contents from your STM32CubeIDE installation into your OpenOCD startup script (just search for a file with that name). That should define the commands.

Device: HP Zook15v

In Linux, keyboard keys (Fn + F2) & (Fn + F3) resolve to the same scancode:

dmesg:

[  343.043330] atkbd serio0: Unknown key pressed (translated set 2, code 0xab on isa0060/serio0).
[  343.043336] atkbd serio0: Use 'setkeycodes e02b <keycode>' to make it known.
[  343.053302] atkbd serio0: Unknown key released (translated set 2, code 0xab on isa0060/serio0).
@shenghaoyang
shenghaoyang / blueEnable_ALARM_non_mainline.md
Last active February 19, 2024 00:14
Bluetooth support on Raspberry Pis running Arch Linux ARM with non-mainline kernel.

#1 Update: Recent Rapsberry Pi (downstream) kernel dt-overlays now exposes a config option "krnbt" that negates the need for all this.

Relevant PRs: raspberrypi/linux#3682

Enabling bluetooth

[Pi 3B (Non-Plus) / Pi Zero W ONLY]

As of kernel package, linux-raspberrypi-4.14.59-1, support for notifying the kernel of the