From 2a4d30e52a755695a2e82ee5662e441cd11205ab Mon Sep 17 00:00:00 2001
From: Zhuowei Zhang <zhuoweizhang@yahoo.com>
Date: Sun, 3 Feb 2019 22:24:04 -0800
Subject: [PATCH] main/postmarketos-mkinitfs: fix USB idVendor/idProduct values
 for ConfigFS (!190)

ConfigFS expects idVendor and idProduct values to be prefixed with 0x.

Without this change, google-crosshatch shows as a device with 0:0 as the
idVendor/idProduct in lsusb:

Bus 001 Device 004: ID 0000:0000

This confuses VirtualBox: it has trouble detaching this device from
a virtual machine, so one must manually use ifconfig to bring down the
old USB network connection before reattaching.

With this change, the idVendor/idProduct is correct:

Bus 001 Device 004: ID 18d1:d001 Google Inc.

This issue also seems to affect other devices with ConfigFS, such as the
Nexus 5:

https://matrix.to/#/!clcCCNrLZYwdfNqkkR:disroot.org/$15487159511194991apGpy:matrix.org
---
 main/postmarketos-mkinitfs/APKBUILD          | 4 ++--
 main/postmarketos-mkinitfs/init_functions.sh | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/main/postmarketos-mkinitfs/APKBUILD b/main/postmarketos-mkinitfs/APKBUILD
index b897044f86b..8531c10c24e 100644
--- a/main/postmarketos-mkinitfs/APKBUILD
+++ b/main/postmarketos-mkinitfs/APKBUILD
@@ -1,5 +1,5 @@
 pkgname=postmarketos-mkinitfs
-pkgver=0.7.4
+pkgver=0.7.5
 pkgrel=0
 pkgdesc="Tool to generate initramfs images for postmarketOS"
 url="https://postmarketos.org"
@@ -25,5 +25,5 @@ package() {
 }
 
 sha512sums="c8ed2697ba0368b907eaefe7544bff8539adc7e8247af6bd425c722e3cedeb34e303f6bd9e00f283921352bc43dff3db83f3b3c1f427ef597ac15323f1e9c3eb  init.sh.in
-3c72a9a5cfef0591dd27c88a76df4db0f50b98f002672c061e77bdb2e6f4ac48d10b5cd85563a89d778a013da6d5a508e5ea70f131971d61545ba18e7094ab8b  init_functions.sh
+e4972ba261a72daba0d1f2fad425a3df082e18263a716746005f31a5cae313d66c168e09cd1bd0af3cee6a97bdb4b329ee3a8d03381a5b104fb39476bdcc7938  init_functions.sh
 5ad842720e7f322bab43aa585103f5bd7e4b11e2e8cce553d406123e4379c160a1b8d7ed1b6aae75b040b2df309c105c412826a8467d552576d6d9ac1f6792ab  mkinitfs.sh"
diff --git a/main/postmarketos-mkinitfs/init_functions.sh b/main/postmarketos-mkinitfs/init_functions.sh
index 5eba61cd306..1cb5e76c1e7 100644
--- a/main/postmarketos-mkinitfs/init_functions.sh
+++ b/main/postmarketos-mkinitfs/init_functions.sh
@@ -219,8 +219,8 @@ setup_usb_network_configfs() {
 	[ -e "$CONFIGFS" ] || return
 
 	mkdir $CONFIGFS/g1
-	printf "%s" "18D1" >"$CONFIGFS/g1/idVendor"
-	printf "%s" "D001" >"$CONFIGFS/g1/idProduct"
+	printf "%s" "0x18D1" >"$CONFIGFS/g1/idVendor"
+	printf "%s" "0xD001" >"$CONFIGFS/g1/idProduct"
 
 	mkdir $CONFIGFS/g1/strings/0x409
 
-- 
GitLab