2
0
mirror of https://github.com/koreader/koreader synced 2024-10-31 21:20:20 +00:00
koreader/platform/cervantes/enable-usbms.sh
Martín Fernández 1e69fae7bc [feat] Add support for BQ/Fnac devices (#4294)
Adds support for devices found in https://blog.bq.com/es/bq-ereaders-developers-program/. Tested on BQ Cervantes 4 (last BQ device from 2017).

It adds a new touch input event handler (discussed in #4275) which should work on other single touch devices (ie: Kobo Touch, Mini, Glo, Aura HD) but wasn't tested.

Includes base bump with: [feat] Add BQ/Fnac device support (https://github.com/koreader/koreader-base/pull/745)
2018-10-31 23:48:36 +01:00

34 lines
846 B
Bash

#!/bin/sh
# based on https://github.com/baskerville/plato/blob/master/scripts/usb-enable.sh
lsmod | grep -q g_file_storage && exit 1
PCB_ID=$(/usr/bin/ntxinfo /dev/mmcblk0 | grep pcb | cut -d ":" -f2)
DISK=/dev/mmcblk
if [ "$PCB_ID" -eq 22 ] || [ "$PCB_ID" -eq 23 ]; then
PRODUCT_ID=${PRODUCT_ID:-"0xAD78"}
PARTITIONS="${DISK}0p7"
else
PRODUCT_ID=${PRODUCT_ID:-"0xAD79"}
PARTITIONS="${DISK}0p4"
fi
[ -e "${DISK}1p1" ] && PARTITIONS="${PARTITIONS},${DISK}1p1"
sync
echo 3 >/proc/sys/vm/drop_caches
for name in public sd; do
DIR=/mnt/"$name"
if grep -q "$DIR" /proc/mounts; then
umount "$DIR" || umount -l "$DIR"
fi
done
MODULE_PARAMETERS="vendor=0x2A47 product=${PRODUCT_ID} vendor_id=BQ product_id=Cervantes"
modprobe g_file_storage file="$PARTITIONS" stall=1 removable=1 "$MODULE_PARAMETERS"
sleep 1