Mysterious USB related GPIO on ES-5/6 series

This forum is for information related with E series hardware.
Post Reply

E3V3A
Posts: 247
Joined: Wed Oct 31, 2012 2:31 am
Location: /dev/zero

Mysterious USB related GPIO on ES-5/6 series

Post by E3V3A »

Was just cruising around in my firmware and found the file: ./etc/Scripts/CIP/8282119 which just makes a core dump to a USB stick...

The funny thing is that in order to use and insmod the USB drivers, it first does this: /sbin/gpio 11 2 out 1

Any ideas what this gpio pin is doing?
SpoilerShow

Code: Select all

#!/bin/sh

MOUNT_DIR="sda1"

check_usb_mount()
{
	while [ 1 == 1 ]
	do
	    if [ -d /dtv/usb/sda ]; then
	        MOUNT_DIR="sda"
	    elif [ -d /dtv/usb/sda1 ]; then
	        MOUNT_DIR="sda1"
	    elif [ -d /dtv/usb/sda2 ]; then
	        MOUNT_DIR="sda2"
	    elif [ -d /dtv/usb/sdb ]; then
	        MOUNT_DIR="sdb"
	    elif [ -d /dtv/usb/sdb1 ]; then
	        MOUNT_DIR="sdb1"
	    elif [ -d /dtv/usb/sdb2 ]; then
	        MOUNT_DIR="sdb2"
	    elif [ -d /dtv/usb/sdc ]; then
	        MOUNT_DIR="sdc"
	    elif [ -d /dtv/usb/sdc1 ]; then
	        MOUNT_DIR="sdc1"
	    elif [ -d /dtv/usb/sdc2 ]; then
	        MOUNT_DIR="sdc2"
	    elif [ -d /dtv/usb/sdd ]; then
	        MOUNT_DIR="sdd"
	    elif [ -d /dtv/usb/sdd1 ]; then
	        MOUNT_DIR="sdd1"
	    elif [ -d /dtv/usb/sdd2 ]; then
	        MOUNT_DIR="sdd2"
	    else
	   	    echo "Please connect usb memory wait 5 seconds..."
    		sleep 5
			continue
	    fi
		return
	done
}

usb_module_insmod()
{
    /sbin/gpio 11 2 out 1
    insmod /lib/modules/usbcore.ko
    insmod /lib/modules/ohci-hcd.ko
    insmod /lib/modules/ehci-hcd.ko
    insmod /lib/modules/usb-storage.ko
    sleep 3
	return
}

usb_remount()
{
	umount /dtv/usb/$MOUNT_DIR
	echo "umount /dtv/usb/$MOUNT_DIR"
	mount -t vfat /dev/$MOUNT_DIR /dtv/usb/$MOUNT_DIR
	echo "mount -t vfat /dev/$MOUNT_DIR /dtv/usb/$MOUNT_DIR"
	sleep 3
}

core_dump()
{
	if [ -e /core/* ]; then
    	cd /core
	    ls
	    echo "cp /core/* /dtv/usb/$MOUNT_DIR/"
    	cp -rf /core/* /dtv/usb/$MOUNT_DIR/
    	sync
	else
	    echo "No Coredump file"
	    return 0
	fi
}

log_dump()
{
	/sbin/logdump /dtv/usb/$MOUNT_DIR/logdump.txt
	sync
	if [ -e /mtd_rwarea/emeg_log.txt ]; then
    	echo "cp /mtd_rwarea/emeg_log.txt /dtv/usb/$MOUNT_DIR/"
	    cp -rf /mtd_rwarea/emeg_log.txt /dtv/usb/$MOUNT_DIR/
    	sync
	else
	    echo "No emeg_log.txt file"
	fi
	echo "cat /proc/kmsg > /dtv/usb/$MOUNT_DIR/kmsg.txt &"
	cat /proc/kmsg > /dtv/usb/$MOUNT_DIR/kmsg.txt &
	sleep 2
	killall -9 cat
	echo "sync"
	sync
}

echo "Check usb module insmod status"
MOD_FLAG=$(lsmod | grep ehci)
if [ "$MOD_FLAG" != "" ]; then
	echo "usb modules exist"
else
	echo "usb modules not exist try to insmod"
	usb_module_insmod
fi

echo "Check usb mount status"
check_usb_mount

echo "Usb re-mount for write speed"
usb_remount

while [ "$SELECT" != "99" ]
do
	echo "===================================="
	echo "      [ DEBUG MENU ]                "
	echo "------------------------------------"
	echo " 1. Copy log to USB	          "
	echo " 2. Copy corefile to USB            "
	echo "===================================="
	echo " 99. Exit                           "
	echo "===================================="
	echo -n "select > "
	read SELECT
	if [ "$SELECT" = "1" ]; then
		log_dump
	elif [ "$SELECT" = "2" ]; then
		core_dump
	fi
done
HW: UE40ES5700SXXH
FW: T-MST10PDEUC-1029.0 Onboot: 1003

User avatar
juusso
SamyGO Moderator
Posts: 10124
Joined: Sun Mar 07, 2010 6:20 pm

Re: Mysterious USB related GPIO on ES-5/6 series

Post by juusso »

Forces LED to blink? :)
LE40B653T5W,UE40D6750,UE65Q8C
Have questions? Read SamyGO Wiki, Search on forum first!
FFB (v0.8), FFB for CI+ . Get root on: C series, D series, E series, F series, H series. rooting K series, exeDSP/exeTV patches[C/D/E/F/H]

DO NOT EVER INSTALL FIRMWARE UPGRADE

E3V3A
Posts: 247
Joined: Wed Oct 31, 2012 2:31 am
Location: /dev/zero

Re: Mysterious USB related GPIO on ES-5/6 series

Post by E3V3A »

Ha ha! Hopefully not, but I was speculating if it is doing some eMMC "write enable" or Watchdog OFF kind of thing...
I've never seen any GPIO's used before doing insmod stuff...
HW: UE40ES5700SXXH
FW: T-MST10PDEUC-1029.0 Onboot: 1003

User avatar
juusso
SamyGO Moderator
Posts: 10124
Joined: Sun Mar 07, 2010 6:20 pm

Re: Mysterious USB related GPIO on ES-5/6 series

Post by juusso »

gpio drives power to USB.
LE40B653T5W,UE40D6750,UE65Q8C
Have questions? Read SamyGO Wiki, Search on forum first!
FFB (v0.8), FFB for CI+ . Get root on: C series, D series, E series, F series, H series. rooting K series, exeDSP/exeTV patches[C/D/E/F/H]

DO NOT EVER INSTALL FIRMWARE UPGRADE

E3V3A
Posts: 247
Joined: Wed Oct 31, 2012 2:31 am
Location: /dev/zero

Re: Mysterious USB related GPIO on ES-5/6 series

Post by E3V3A »

How do you know this? (It doesn't make sense in the context of dumping core to USB...)
HW: UE40ES5700SXXH
FW: T-MST10PDEUC-1029.0 Onboot: 1003

sbav1
Official SamyGO Developer
Posts: 374
Joined: Fri Jan 15, 2010 10:20 am

Re: Mysterious USB related GPIO on ES-5/6 series

Post by sbav1 »

There is similar, dedicated GPIO pin in Firenze BD-D* devices - it's output is connected to TPS2553 chip, and it just enables external USB port 5V power. In Mstar E5|6XXX models things may be somehow more complicated (perhaps there is an onboard USB hub chip like on E8XXX boards, etc.), but I don't expect anything radically different..

E3V3A
Posts: 247
Joined: Wed Oct 31, 2012 2:31 am
Location: /dev/zero

Re: Mysterious USB related GPIO on ES-5/6 series

Post by E3V3A »

That make more sense, but my problem is with understanding why it would be "off" in the first place? Certainly the USB driver takes care of all the detection + power, so perhaps it's just there for backward compatibility for older devices...

Very Crazy Idea: I wonder what would happen if we just connect our PC USB directly to TV with gender changer. (But perhaps without the 5V line!)
[Don't do this, just speculation.] If that would work, I'd guess the TV would get listed as USB slave...just like a mobile phone in debug mode. And if we're really lucky, it would be listed as a Samsung serial device and we wouldn't need any ExLink anymore!
HW: UE40ES5700SXXH
FW: T-MST10PDEUC-1029.0 Onboot: 1003

Post Reply

Return to “[E] Hardware”