Skip to content

Instantly share code, notes, and snippets.

View kcxt's full-sized avatar
🏳️‍🌈

Casey Connolly kcxt

🏳️‍🌈
View GitHub Profile
@kcxt
kcxt / edid_parser.c
Created September 21, 2021 13:30
Very basic edid parse to check for audio support
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#define HDMI_EDID_PATH "edid.bin"
#define ALOGE(...) (printf(__VA_ARGS__))
struct edid_extension {
unsigned char tag;
@kcxt
kcxt / bisect-test.sh
Created September 16, 2021 15:07
Very hacky script for automatically bisecting kernel regressions on devices like the OnePlus 6
#!/bin/bash
# basically what at-to_bootloader_hard does, turns off the USB port the phone is connected to so that
# VBUS is low and the device won't go to EDL (yay oneplus)
# then sends a byte to the arduino to tell it to perform a hard reboot by pressing volume up and power
# finally turn the usb port back on
# sudo uhubctl -a off -p 2 -n 2109:2812 && printf "%b" "\0x01" > /dev/ttyACM0 && sleep 15 && sudo uhubctl -a on -p 2 -n 2109:2812
export TOOLSDIR=$HOME/pmos/tools
#!/bin/bash
exec &> /var/log/sdm845-modem-prepare.log
AID=$(qmicli -d qrtr://0 -p --uim-get-card-status | grep -E "([A-Z0-9]{2}:){15}[A-Z0-9]{2}" | xargs)
while [ -z "$AID" ]; do
sleep 2
AID=$(qmicli -d qrtr://0 -p --uim-get-card-status | grep -E "([A-Z0-9]{2}:){15}[A-Z0-9]{2}" | xargs)
done
@kcxt
kcxt / mm-tracking-guide.txt
Created April 23, 2021 16:14
Instructions for testing ModemManager on QRTR modems
Yeah, you can get it going in postmarketOS by using my pmaports branch here: https://gitlab.com/sdm845-mainline/pmaports/-/tree/mm-tracking
You'll need to get rid of the top commit it was just for my testing and doesn't work.
Checkout HEAD~1 ("modemmanager: QRTR testing") and then change the modem manager APKBUILD to use this branch: https://gitlab.freedesktop.org/aleksm/ModemManager/-/tree/aleksander/qmap-settings-udev (from !501). Then:
pmbootstrap checksum modemmanager
pmbootstrap build libqrtr-glib --arch aarch64
pmbootstrap build libqmi -- arch aarch64
pmbootstrap build modemmanager -- arch aarch64
@kcxt
kcxt / spcurrent.sh
Created September 1, 2020 03:56
Fire a notification to display the currently playing spotify track using sp
#!/bin/zsh
METADATA=$(sp metadata)
# Example
#trackid|spotify:track:6NKuZs5wDpbkJaAFfKz5lI
#trackNumber|11
#discNumber|1
#url|https://open.spotify.com/track/6NKuZs5wDpbkJaAFfKz5lI
#autoRating|0.42
-- Logs begin at Mon 2020-08-10 13:38:50 BST, end at Thu 2020-08-13 13:07:47 BST. --
Aug 10 23:40:27 cheetah systemd[1]: Starting Fingerprint Authentication Daemon...
-- Subject: A start job for unit fprintd.service has begun execution
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- A start job for unit fprintd.service has begun execution.
--
-- The job identifier is 3156.
Aug 10 23:40:27 cheetah fprintd[53466]: Device responded with error: 789
@kcxt
kcxt / broken_oneplus.md
Last active July 20, 2020 20:09
A table of instances where a oneplus 6/t becomes soft bricked after flashing something custom. Please comment if this happens to you with details and your exact device model number.
Name Model Attempted to flash Slot Symptoms
Fajita A6013 Halium a Device would not turn on at all, booted into QCOM mode to recovery mode.
@kcxt
kcxt / mkbootimg.sh
Created May 25, 2020 00:48
Run in a kernel source tree to make a boot image from a mainline kernel (assume $HOME/pmos exists be default)
#!/bin/bash
OUT="$HOME/pmos/mainline-boot.img"
DTB="$PWD/.output/arch/arm64/boot/dts/qcom/sdm845-oneplus-enchilada.dtb"
IMAGE="$PWD/.output/arch/arm64/boot/Image.gz"
THIS="$(basename $0)"
die() {
echo $1 1>&2
@kcxt
kcxt / creategadget.sh
Created May 24, 2020 20:29
create a USB gadget using configfs
#!/bin/sh
# Originally from: https://gitlab.com/postmarketOS/pmaports/-/blob/master/main/postmarketos-mkinitfs/init_functions.sh#L264
# See: https://www.kernel.org/doc/Documentation/usb/gadget_configfs.txt
mkdir -p /config
mount none -t configfs /config
CONFIGFS=/config/usb_gadget
@kcxt
kcxt / bandcamp-multidl.sh
Last active May 19, 2020 13:45
Download all albums for an artist from bandcamp using bandcamp-dl
#!/bin/bash
# bandcamp-multidl.sh URL [DESTINATION]
if [ -z $1 ]; then
echo "No URL specified"
exit 1
fi
if [ ! which bandcamp-dl ]; then