Skip to contentSkip to conversation

How to debug hotplug script command line

DISCUSSION amruth 1 participant 1 message Jul 20, 2008

lore
Share & tools
lore

amruth

author
#0 lore raw

Hi
Does anybody know how to debug hotplug script without hotplugging the device. I am try to debug usbserial device ti_usb_3410_5052.hotplug device after downloading firmware. I see that the hotplug fails error -5. I need to see what is going on after downloading the firmware. How to debug the script.I know /sbin/hotplug debug=1, shows some info, but not completely. The script is below and copied to /etc/udev/hotplug.d. My kernel is linux 2.6.26 on rehat enterprise linux4.

BOOT_CONFIG=1
ACTIVE_CONFIG=2

if [[ "$ACTION" != "add" ]]
then
exit
fi

CONFIG_PATH=/sys${DEVPATH%/?*}/bConfigurationValue

if [[ 0cat $CONFIG_PATH -ne $BOOT_CONFIG ]]
then
exit
fi

PRODUCT=${PRODUCT%/?*} # delete version
VENDOR_ID=printf "%d" 0x${PRODUCT%/?*}
PRODUCT_ID=printf "%d" 0x${PRODUCT#*?/}

PARAM_PATH=/sys/module/ti_usb_3410_5052/parameters

function scan() {
	s=$1
	shift
	for i
	do
		if [[ $s -eq $i ]]
		then
			return 0
		fi
	done
	return 1
}

IFS=$IFS,

if (scan $VENDOR_ID 1105 1760 cat $PARAM_PATH/vendor_3410 &&
scan $PRODUCT_ID 13328 61704 61705 61712 61713 61714 cat $PARAM_PATH/product_3410) || (scan $VENDOR_ID 1105 cat $PARAM_PATH/vendor_5052 &&
scan $PRODUCT_ID 20562 20818 20570 20575 cat $PARAM_PATH/product_5052) then
echo $ACTIVE_CONFIG > $CONFIG_PATH
fi

Thanks