Web lists-archives.com

Re: [Spca50x-devs] ip293x for linux




On Wed, 12 Aug 2009 15:37:37 -0400
Asif Iqbal <vadud3@xxxxxxxxx> wrote:

> I have a ipassion webcam (below) that I need help with building a
> driver for linux. I am using ubuntu 9.04
> 
>    Bus 003 Device 002: ID 1b3b:2936 iPassion Technology Inc. PC
> Camera/WebCam controller
> 
> I have collected about 750mb of usbsnoop data from windows.
> 
> Is there a public place where I can dump a little bit of that data and
> get some help to make a linux driver?

Hi Asif,

I am very busy, but I can have a look on your traces.

As a first step, I would know a bit about the USB exchanges. I'm joining
a usbsnoop parser. May you use it with your trace and send me the
resulting output?

Cheers.

-- 
Ken ar c'hentañ	|	      ** Breizh ha Linux atav! **
Jef		|		http://moinejf.free.fr/
#!/bin/sh
# -*- tcl -*- \
exec tclsh "$0" ${1+"$@"}

proc usage {} {
	puts "Parse a ms-win USB snoop
Usage:
	parsnoop \[options\] <usbsnoop file>
Options:
	-nb	Don't display the Bulk/Interrupt messages
	-ni	Don't display the Isochronous messages
	-t	Display the delta time between exchanges"
	exit
}

proc isoc {fd} {
	global deltatime noisoc
	set in 0
	while {[gets $fd line] >= 0} {
		switch -regexp -- $line {
		    "  URB " break
		    StartFrame {
			if {[string compare [lindex $line 2] 00000000] != 0} {
				set in 1
			}
		    }
		    TransferBufferLength {
			set l [lindex $line 2]
		    }
		    NumberOfPackets {
			set n [lindex $line 2]
		    }
		}
	}
	if {!$in || $noisoc} {
		return $line
	}
	puts -nonewline $deltatime
	puts [format "<isoc \[%d\] l:%d" 0x$n 0x$l]
	return $line
}

proc vendor {fd} {
# outgoing message
	global deltatime
	set out 0
	set b {}
	while {[gets $fd line] >= 0} {
		switch -regexp -- $line {
		    "  URB " break
		    DIRECTION_OUT {
			set out 1
		    }
		    TransferBufferLength {
#			set l 0x[lindex $line 3]
		    }
		    00000..0: {
			if {$out} {
				if {[string length $b] != 0} {
					append b "\n\t\t  "
				}
				append b [lrange $line 1 end]
			}
		    }
		    "Request" {
			set r [format %02x 0x[lindex $line 2]]
		    }
		    "Value" {
			set v [format %04x 0x[lindex $line 2]]
		    }
		    "Index" {
			set i [format %04x 0x[lindex $line 2]]
		    }
		}
	}
	if {$out} {
		puts -nonewline $deltatime
		puts " SET $r $v $i $b"
	}
	return $line
}

proc ctrl {fd} {
# incoming message
	global deltatime
	set in 0
	set b {}
	set setup 0
	while {[gets $fd line] >= 0} {
		switch -regexp -- $line {
		    "  URB " break
		    DIRECTION_IN {
			set in 1
		    }
		    SetupPacket {
			set setup 1
		    }
		    "  00000" {
			if {!$in} continue
			if {!$setup} {
				if {[string length $b] == 0} {
					set b [lrange $line 1 end]
				} else {
					append b "\n<\t\t  "
					append b [lrange $line 1 end]
				}
			} else {
				set r [lindex $line 2]
				set v [lindex $line 4][lindex $line 3]
				set i [lindex $line 6][lindex $line 5]
			}
		    }
		}
	}
	if {$in} {
		puts -nonewline $deltatime
		puts "<GET $r $v $i $b"
	}
	return $line
}

proc interf {fd} {
# select interface
	global deltatime
	set i {??}
	set a {??}
	while {[gets $fd line] >= 0} {
		switch -regexp -- $line {
		    "  URB " break
		    InterfaceNumber {
			set i [format %02x 0x[lindex $line 3]]
		    }
		    AlternateSetting {
			set a [format %02x 0x[lindex $line 3]]
		    }
		}
	}
	puts -nonewline $deltatime
	puts " intf $i alt $a"
	return $line
}

proc feature {fd} {
	global deltatime
	while {[gets $fd line] >= 0} {
		switch -regexp -- $line {
		    "  URB " break
		}
	}
puts -nonewline $deltatime
puts "feature"
	return $line
}

proc transf {fd} {
# bulk or interrupt transfer
	global deltatime nobulk
	set in 0
	set b {}
	while {[gets $fd line] >= 0} {
		switch -regexp -- $line {
		    DIRECTION_IN {
			set in 1
		    }
		    "  00000" {
			if {[string length $b] == 0} {
				set b [lrange $line 1 end]
			} else {
				append b "\n\t\t  "
				append b [lrange $line 1 end]
			}
		    }
		    "  URB " break
		}
	}
	if {$nobulk || [string length $b] == 0} {
		return $line
	}
	puts -nonewline $deltatime
	if {$in} {
		puts "<Bulk/Int IN  $b"
	} else {
		puts " Bulk/Int OUT $b"
	}
	return $line
}

proc main {argv} {
	global nowtime prevtime withtime deltatime nobulk noisoc
	set withtime 0
	set nobulk 0
	set noisoc 0
	set deltatime {}
	set fn {}
	foreach a $argv {
		switch -regexp -- $a {
		    -t {
			set withtime 1
		    }
		    -nb {
			set nobulk 1
		    }
		    -ni {
			set noisoc 1
		    }
		    default {
			if {[string length $fn] != 0} usage
			set fn $a
		    }
		}
	}
	if {[string length $fn] == 0} usage
	if {[catch {open $fn r} fd]} {
		puts "cannot open '$fn'"
		exit 1
	}
	set nowtime 0
	set prevtime 0
	set nisoc 0
	while {[gets $fd line] >= 0} {
		set isoc 0
		switch -regexp -- $line {
		    URB_FUNCTION_ISOCH_TRANSFER {
			set line [isoc $fd]
			set isoc 1
			incr nisoc
		    }
		    URB_FUNCTION_VENDOR {
			set line [vendor $fd]
		    }
		    URB_FUNCTION_CONTROL_TRANSFER {
			set line [ctrl $fd]
		    }
		    URB_FUNCTION_SELECT_INTERFACE {
			set line [interf $fd]
		    }
		    URB_FUNCTION_SET_FEATURE_TO_DEVICE {
			set line [feature $fd]
		    }
		    URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER {
			set line [transf $fd]
		    }
		}
		if {!$isoc && $nisoc != 0} {
			puts -nonewline $deltatime
			puts "$nisoc isoc"
			set nisoc 0
		}
		if {[regexp {\[([0-9]+) ms\]} $line dum ntime]} {
			set prevtime $nowtime
			set nowtime $ntime
			if {[string first down $line] > 0} {
				if {$withtime} {
					set deltatime [format "%4d " \
						[expr {$nowtime - $prevtime}]]
				} elseif {$nowtime > $prevtime + 2} {
					puts "== +[expr {$nowtime - $prevtime}] ms"
				}
			}
			if {$nowtime > $prevtime + 200} {
				puts "== \[$nowtime ms\]"
			}
		}
	}
}

main $argv
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Spca50x-devs mailing list
Spca50x-devs@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/spca50x-devs