mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-27 20:15:29 +00:00
First find blocks by-name, then fallback to parsing sysfs
This commit is contained in:
parent
6c4d81b1e9
commit
b5b8c4b725
@ -45,6 +45,14 @@ toupper() {
|
||||
}
|
||||
|
||||
find_block() {
|
||||
for BLOCK in "$@"; do
|
||||
DEVICE=`find /dev/block -type l -iname $BLOCK | head -n 1` 2>/dev/null
|
||||
if [ ! -z $DEVICE ]; then
|
||||
readlink -f $DEVICE
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
# Fallback by parsing sysfs uevents
|
||||
for uevent in /sys/dev/block/*/uevent; do
|
||||
local DEVNAME=`grep_prop DEVNAME $uevent`
|
||||
local PARTNAME=`grep_prop PARTNAME $uevent`
|
||||
|
Loading…
Reference in New Issue
Block a user