Skip to content

Instantly share code, notes, and snippets.

/system/bin/ip link add eth_slave type veth peer name slave
ifconfig eth0 down
ip link set eth0 name nfsif
ifconfig nfsif up
#We're changing ip routes/interfaces while nfs is mounted... sounds very safe.
ifconfig nfsif 0.0.0.0 up
brctl addbr br0
#Add nfsif first to get the same MAC, and, hopefully, same IP
@phhusson
phhusson / gist:c80b25f668b57d4694c5ffd5384e602a
Created March 5, 2020 20:11
OPPO/Realme/OnePlus optical fingerprint sensor
diff --git a/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp b/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp
index 5ce72b087..a926413a9 100644
--- a/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp
+++ b/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp
@@ -335,7 +335,19 @@ void OutputLayer::writeStateToHWC(bool includeGeometry) const {
static_cast<int32_t>(error));
}
- if (auto error = hwcLayer->setZOrder(mState.z); error != HWC2::Error::None) {
+ int z = mState.z;
/ # cat /sys/fs/pstore/console-ramoops-0
[ 0.000000] Booting Linux on physical CPU 0x0000000000 [0x51af8014]
[ 0.000000] Linux version 5.6.0-rc1-00344-g713db3560410-dirty (phh@phh-desktop) (gcc version 8.3.0 (Debian 8.3.0-2)) #7 SMP PREEMPT Sun Feb 16 21:30:05 CET 2020
[ 0.000000] Machine model: Qualcomm Technologies, Inc. MSM 8998 V2 SKUK T5
[ 0.000000] efi: Getting EFI parameters from FDT:
[ 0.000000] efi: UEFI not found.
[ 0.000000] cma: Reserved 32 MiB at 0x00000000fe000000
[ 0.000000] OF: fdt: earlycon: stdout-path serial0 not found
[ 0.000000] NUMA: No NUMA configuration found
[ 0.000000] NUMA: Faking a node at [mem 0x0000000080000000-0x000000017e3bffff]
@phhusson
phhusson / toto.diff
Created January 31, 2020 21:08
build-dakkar download patches
diff --git a/build-dakkar.sh b/build-dakkar.sh
index 7fb76b9..93bc2dc 100644
--- a/build-dakkar.sh
+++ b/build-dakkar.sh
@@ -398,9 +398,23 @@ function init_local_manifest() {
clone_or_checkout .repo/local_manifests treble_manifest
}
+download_patches() {
+ if [[ $localManifestBranch == android-10.0 ]];then
@phhusson
phhusson / gist:963d86d56e521a66f01eeb2ca1b8fd41
Created January 12, 2020 12:34
omx-store result on Essential PH-1
Got prefix OMX.
Role audio_decoder.aac
Type: audio/mp4a-latm
Nodes:
OMX.google.aac.decoder
default
bitrate-range=8000-960000
max-channel-count=8
sample-rate-ranges=7350,8000,11025,12000,16000,22050,24000,32000,44100,48000
Role audio_decoder.amrnb
@phhusson
phhusson / omx-store.cpp
Created January 12, 2020 12:30
List OMX codecs through treble HAL
#include <iostream>
#include <unistd.h>
#include <android/hardware/media/omx/1.0/IOmxStore.h>
using ::android::hardware::media::omx::V1_0::IOmxStore;
using ::android::sp;
int main(int argc, char **argv) {
auto svc = IOmxStore::getService();
{
@phhusson
phhusson / run-in-netns
Created January 6, 2020 17:41
Runs a program in a program within a netns that temporary steals a host interface
#!/bin/bash
#This script "steals" an interface from the host to a temporary network namespace
#Then, Linux will release the interface back to the host
#Teardown is guaranteed by kernel when all pid with iface/netns are dead
iface="$1"
shift
cmd=""
#define SCREEN_MODE_NORMAL 0
#define SCREEN_MODE_FULL_STRETCH 1
#define SCREEN_MODE_4_3 2
#define SCREEN_MODE_16_9 3
#define SCREEN_MODE_NONLINEAR 4
#define SCREEN_MODE_NORMAL_NOSCALEUP 5
#define SCREEN_MODE_CROP_FULL 6
#define SCREEN_MODE_CROP 7
project MediaLib/
diff --git a/MediaLib/src/com/archos/mediascraper/ScraperImage.java b/MediaLib/src/com/archos/mediascraper/ScraperImage.java
index 1d21ed6..bd17c2e 100644
--- a/MediaLib/src/com/archos/mediascraper/ScraperImage.java
+++ b/MediaLib/src/com/archos/mediascraper/ScraperImage.java
@@ -396,7 +397,12 @@ public class ScraperImage {
private static final MultiLock<String> sLock = new MultiLock<String>();
public final boolean download(Context context) {
- return download(context, false, 0, 0, false);
project MediaLib/
diff --git a/MediaLib/src/com/archos/mediascraper/ScraperImage.java b/MediaLib/src/com/archos/mediascraper/ScraperImage.java
index 1d21ed6..bd17c2e 100644
--- a/MediaLib/src/com/archos/mediascraper/ScraperImage.java
+++ b/MediaLib/src/com/archos/mediascraper/ScraperImage.java
@@ -32,12 +32,13 @@ import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
+import java.util.concurrent.ExecutionException;