Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

usbview 0.2.0 release

  • Loading branch information...
commit fe5adfd9b214cc09da6051f7f3ca571d672ad7c7 1 parent 821faab
@gregkh authored
View
6 ChangeLog
@@ -1,3 +1,9 @@
+version 0.2.0:
+ - Configuration, interface, and endpoint data is now displayed
+ for each device.
+ - Fixed problem with processing the last line in the /proc/... file
+ twice.
+
Initial version 0.1.0:
- devices are read from /proc/bus/usb/devices and put into a tree view
- very basic information is displayed about each device when it is
View
1  confdefs.h
@@ -1 +0,0 @@
-
View
0  config.cache
No changes.
View
131 config.h
@@ -1,131 +0,0 @@
-/* config.h. Generated automatically by configure. */
-/* config.h.in. Generated automatically from configure.in by autoheader. */
-
-/* Define if using alloca.c. */
-/* #undef C_ALLOCA */
-
-/* Define to empty if the keyword does not work. */
-/* #undef const */
-
-/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
- This function is required for alloca.c support on those systems. */
-/* #undef CRAY_STACKSEG_END */
-
-/* Define if you have alloca, as a function or macro. */
-#define HAVE_ALLOCA 1
-
-/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
-#define HAVE_ALLOCA_H 1
-
-/* Define if you have a working `mmap' system call. */
-#define HAVE_MMAP 1
-
-/* Define as __inline if that's what the C compiler calls it. */
-/* #undef inline */
-
-/* Define to `long' if <sys/types.h> doesn't define. */
-/* #undef off_t */
-
-/* Define if you need to in order for stat and other things to work. */
-/* #undef _POSIX_SOURCE */
-
-/* Define to `unsigned' if <sys/types.h> doesn't define. */
-/* #undef size_t */
-
-/* If using the C implementation of alloca, define if you know the
- direction of stack growth for your system; otherwise it will be
- automatically deduced at run-time.
- STACK_DIRECTION > 0 => grows toward higher addresses
- STACK_DIRECTION < 0 => grows toward lower addresses
- STACK_DIRECTION = 0 => direction of growth unknown
- */
-/* #undef STACK_DIRECTION */
-
-/* Define if you have the ANSI C header files. */
-#define STDC_HEADERS 1
-
-#define ENABLE_NLS 1
-/* #undef HAVE_CATGETS */
-#define HAVE_GETTEXT 1
-#define HAVE_LC_MESSAGES 1
-#define HAVE_STPCPY 1
-/* #undef HAVE_LIBSM */
-#define PACKAGE_LOCALE_DIR "/usr/local/share/locale"
-#define PACKAGE_DATA_DIR "/usr/local/share/usbview"
-#define PACKAGE_SOURCE_DIR "/home/greg/src/usbview"
-
-/* Define if you have the __argz_count function. */
-#define HAVE___ARGZ_COUNT 1
-
-/* Define if you have the __argz_next function. */
-#define HAVE___ARGZ_NEXT 1
-
-/* Define if you have the __argz_stringify function. */
-#define HAVE___ARGZ_STRINGIFY 1
-
-/* Define if you have the dcgettext function. */
-#define HAVE_DCGETTEXT 1
-
-/* Define if you have the getcwd function. */
-#define HAVE_GETCWD 1
-
-/* Define if you have the getpagesize function. */
-#define HAVE_GETPAGESIZE 1
-
-/* Define if you have the munmap function. */
-#define HAVE_MUNMAP 1
-
-/* Define if you have the putenv function. */
-#define HAVE_PUTENV 1
-
-/* Define if you have the setenv function. */
-#define HAVE_SETENV 1
-
-/* Define if you have the setlocale function. */
-#define HAVE_SETLOCALE 1
-
-/* Define if you have the stpcpy function. */
-#define HAVE_STPCPY 1
-
-/* Define if you have the strcasecmp function. */
-#define HAVE_STRCASECMP 1
-
-/* Define if you have the strchr function. */
-#define HAVE_STRCHR 1
-
-/* Define if you have the strdup function. */
-#define HAVE_STRDUP 1
-
-/* Define if you have the <argz.h> header file. */
-#define HAVE_ARGZ_H 1
-
-/* Define if you have the <limits.h> header file. */
-#define HAVE_LIMITS_H 1
-
-/* Define if you have the <locale.h> header file. */
-#define HAVE_LOCALE_H 1
-
-/* Define if you have the <malloc.h> header file. */
-#define HAVE_MALLOC_H 1
-
-/* Define if you have the <nl_types.h> header file. */
-#define HAVE_NL_TYPES_H 1
-
-/* Define if you have the <string.h> header file. */
-#define HAVE_STRING_H 1
-
-/* Define if you have the <sys/param.h> header file. */
-#define HAVE_SYS_PARAM_H 1
-
-/* Define if you have the <unistd.h> header file. */
-#define HAVE_UNISTD_H 1
-
-/* Define if you have the i library (-li). */
-/* #undef HAVE_LIBI */
-
-/* Name of package */
-#define PACKAGE "usbview"
-
-/* Version number of package */
-#define VERSION "0.1"
-
View
3  config.log
@@ -1,3 +0,0 @@
-This file contains any messages produced by compilers while
-running configure, to aid debugging if configure makes a mistake.
-
View
214 intl/Makefile
@@ -1,214 +0,0 @@
-# Generated automatically from Makefile.in by configure.
-# Makefile for directory with message catalog handling in GNU NLS Utilities.
-# Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-PACKAGE = usbview
-VERSION = 0.1
-
-SHELL = /bin/sh
-
-srcdir = .
-top_srcdir = ..
-top_builddir = ..
-
-prefix = /usr/local
-exec_prefix = ${prefix}
-transform = s,x,x,
-libdir = $(exec_prefix)/lib
-includedir = $(prefix)/include
-datadir = $(prefix)/share
-localedir = $(datadir)/locale
-gnulocaledir = $(prefix)/share/locale
-gettextsrcdir = ${prefix}/share/gettext/intl
-aliaspath = $(localedir):.
-subdir = intl
-
-INSTALL = /usr/bin/install -c
-INSTALL_DATA = ${INSTALL} -m 644
-MKINSTALLDIRS = ./mkinstalldirs
-
-l =
-
-AR = ar
-CC = gcc
-LIBTOOL = @LIBTOOL@
-RANLIB = ranlib
-
-DEFS = -DLOCALEDIR=\"$(localedir)\" -DGNULOCALEDIR=\"$(gnulocaledir)\" \
--DLOCALE_ALIAS_PATH=\"$(aliaspath)\" -DHAVE_CONFIG_H
-CPPFLAGS =
-CFLAGS = -g -O2 -Wall
-LDFLAGS =
-
-COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
-
-HEADERS = $(COMHDRS) libgettext.h loadinfo.h
-COMHDRS = gettext.h gettextP.h hash-string.h
-SOURCES = $(COMSRCS) intl-compat.c cat-compat.c
-COMSRCS = bindtextdom.c dcgettext.c dgettext.c gettext.c \
-finddomain.c loadmsgcat.c localealias.c textdomain.c l10nflist.c \
-explodename.c
-OBJECTS = bindtextdom.$lo dcgettext.$lo dgettext.$lo gettext.$lo \
-finddomain.$lo loadmsgcat.$lo localealias.$lo textdomain.$lo l10nflist.$lo \
-explodename.$lo
-CATOBJS = cat-compat.$lo ../po/cat-id-tbl.$lo
-GETTOBJS = intl-compat.$lo
-DISTFILES.common = ChangeLog Makefile.in linux-msg.sed po2tbl.sed.in \
-xopen-msg.sed $(HEADERS) $(SOURCES)
-DISTFILES.normal = VERSION
-DISTFILES.gettext = libintl.glibc intlh.inst.in
-
-.SUFFIXES:
-.SUFFIXES: .c .o .lo
-.c.o:
- $(COMPILE) $<
-.c.lo:
- $(LIBTOOL) --mode=compile $(COMPILE) $<
-
-INCLUDES = -I.. -I. -I$(top_srcdir)/intl -I$(top_srcdir)/lib
-
-all: all-no
-
-all-yes: libintl.$la intlh.inst
-all-no:
-
-libintl.a: $(OBJECTS)
- rm -f $@
- $(AR) cru $@ $(OBJECTS)
- $(RANLIB) $@
-
-libintl.la: $(OBJECTS)
- $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ $(OBJECTS) \
- -version-info 1:0 -rpath $(libdir)
-
-../po/cat-id-tbl.$lo: ../po/cat-id-tbl.c $(top_srcdir)/po/$(PACKAGE).pot
- cd ../po && $(MAKE) cat-id-tbl.$lo
-
-check: all
-
-# This installation goal is only used in GNU gettext. Packages which
-# only use the library should use install instead.
-
-# We must not install the libintl.h/libintl.a files if we are on a
-# system which has the gettext() function in its C library or in a
-# separate library or use the catgets interface. A special case is
-# where configure found a previously installed GNU gettext library.
-# If you want to use the one which comes with this version of the
-# package, you have to use `configure --with-included-gettext'.
-install: install-exec install-data
-install-exec: all
- if test "$(PACKAGE)" = "gettext" \
- && test '' = '$(GETTOBJS)'; then \
- if test -r $(MKINSTALLDIRS); then \
- $(MKINSTALLDIRS) $(libdir) $(includedir); \
- else \
- $(top_srcdir)/mkinstalldirs $(libdir) $(includedir); \
- fi; \
- $(INSTALL_DATA) intlh.inst $(includedir)/libintl.h; \
- $(INSTALL_DATA) libintl.a $(libdir)/libintl.a; \
- else \
- : ; \
- fi
-install-data: all
- if test "$(PACKAGE)" = "gettext"; then \
- if test -r $(MKINSTALLDIRS); then \
- $(MKINSTALLDIRS) $(gettextsrcdir); \
- else \
- $(top_srcdir)/mkinstalldirs $(gettextsrcdir); \
- fi; \
- $(INSTALL_DATA) VERSION $(gettextsrcdir)/VERSION; \
- dists="$(DISTFILES.common)"; \
- for file in $$dists; do \
- $(INSTALL_DATA) $(srcdir)/$$file $(gettextsrcdir)/$$file; \
- done; \
- else \
- : ; \
- fi
-
-# Define this as empty until I found a useful application.
-installcheck:
-
-uninstall:
- dists="$(DISTFILES.common)"; \
- for file in $$dists; do \
- rm -f $(gettextsrcdir)/$$file; \
- done
-
-info dvi:
-
-$(OBJECTS): ../config.h libgettext.h
-bindtextdom.$lo finddomain.$lo loadmsgcat.$lo: gettextP.h gettext.h loadinfo.h
-dcgettext.$lo: gettextP.h gettext.h hash-string.h loadinfo.h
-
-tags: TAGS
-
-TAGS: $(HEADERS) $(SOURCES)
- here=`pwd`; cd $(srcdir) && etags -o $$here/TAGS $(HEADERS) $(SOURCES)
-
-id: ID
-
-ID: $(HEADERS) $(SOURCES)
- here=`pwd`; cd $(srcdir) && mkid -f$$here/ID $(HEADERS) $(SOURCES)
-
-
-mostlyclean:
- rm -f *.a *.o *.lo core core.*
-
-clean: mostlyclean
-
-distclean: clean
- rm -f Makefile ID TAGS po2msg.sed po2tbl.sed
-
-maintainer-clean: distclean
- @echo "This command is intended for maintainers to use;"
- @echo "it deletes files that may require special tools to rebuild."
-
-
-# GNU gettext needs not contain the file `VERSION' but contains some
-# other files which should not be distributed in other packages.
-distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
-dist distdir: Makefile $(DISTFILES)
- if test "$(PACKAGE)" = gettext; then \
- additional="$(DISTFILES.gettext)"; \
- else \
- additional="$(DISTFILES.normal)"; \
- fi; \
- for file in $(DISTFILES.common) $$additional; do \
- ln $(srcdir)/$$file $(distdir) 2> /dev/null \
- || cp -p $(srcdir)/$$file $(distdir); \
- done
-
-dist-libc:
- tar zcvf intl-glibc.tar.gz $(COMSRCS) $(COMHDRS) libintl.h.glibc
-
-Makefile: Makefile.in ../config.status
- cd .. \
- && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
-
-# The dependency for intlh.inst is different in gettext and all other
-# packages. Because we cannot you GNU make features we have to solve
-# the problem while rewriting Makefile.in.
-#YES#intlh.inst: intlh.inst.in ../config.status
-#YES# cd .. \
-#YES# && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= \
-#YES# $(SHELL) ./config.status
-.PHONY: intlh.inst
-intlh.inst:
-
-# Tell versions [3.59,3.63) of GNU make not to export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
View
252 po/Makefile
@@ -1,252 +0,0 @@
-# Generated automatically from Makefile.in.in by configure.
-# Makefile for program source directory in GNU NLS utilities package.
-# Copyright (C) 1995, 1996, 1997 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
-#
-# This file file be copied and used freely without restrictions. It can
-# be used in projects which are not available under the GNU Public License
-# but which still want to provide support for the GNU gettext functionality.
-# Please note that the actual code is *not* freely available.
-
-PACKAGE = usbview
-VERSION = 0.1
-
-SHELL = /bin/sh
-
-
-srcdir = .
-top_srcdir = ..
-
-prefix = /usr/local
-exec_prefix = ${prefix}
-datadir = $(prefix)/share
-localedir = $(datadir)/locale
-gnulocaledir = $(prefix)/share/locale
-gettextsrcdir = $(prefix)/share/gettext/po
-subdir = po
-
-INSTALL = /usr/bin/install -c
-INSTALL_DATA = ${INSTALL} -m 644
-MKINSTALLDIRS = $(top_srcdir)/./mkinstalldirs
-
-CC = gcc
-GENCAT =
-GMSGFMT = PATH=../src:$$PATH /usr/bin/msgfmt
-MSGFMT = /usr/bin/msgfmt
-XGETTEXT = PATH=../src:$$PATH /usr/bin/xgettext
-MSGMERGE = PATH=../src:$$PATH msgmerge
-
-DEFS = -DHAVE_CONFIG_H
-CFLAGS = -g -O2 -Wall
-CPPFLAGS =
-
-INCLUDES = -I.. -I$(top_srcdir)/intl
-
-COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
-
-SOURCES = cat-id-tbl.c
-POFILES =
-GMOFILES =
-DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(PACKAGE).pot \
-stamp-cat-id $(POFILES) $(GMOFILES) $(SOURCES)
-
-POTFILES = \
- ../src/main.c \
- ../src/interface.c \
- ../src/callbacks.c \
- ../src/support.c
-
-CATALOGS =
-CATOBJEXT = .gmo
-INSTOBJEXT = .mo
-
-.SUFFIXES:
-.SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat
-
-.c.o:
- $(COMPILE) $<
-
-.po.pox:
- $(MAKE) $(PACKAGE).pot
- $(MSGMERGE) $< $(srcdir)/$(PACKAGE).pot -o $*.pox
-
-.po.mo:
- $(MSGFMT) -o $@ $<
-
-.po.gmo:
- file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \
- && rm -f $$file && $(GMSGFMT) -o $$file $<
-
-.po.cat:
- sed -f ../intl/po2msg.sed < $< > $*.msg \
- && rm -f $@ && $(GENCAT) $@ $*.msg
-
-
-all: all-yes
-
-all-yes: cat-id-tbl.c $(CATALOGS)
-all-no:
-
-$(srcdir)/$(PACKAGE).pot: $(POTFILES)
- $(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(top_srcdir) \
- --add-comments --keyword=_ --keyword=N_ \
- --files-from=$(srcdir)/POTFILES.in \
- && test ! -f $(PACKAGE).po \
- || ( rm -f $(srcdir)/$(PACKAGE).pot \
- && mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot )
-
-$(srcdir)/cat-id-tbl.c: stamp-cat-id; @:
-$(srcdir)/stamp-cat-id: $(PACKAGE).pot
- rm -f cat-id-tbl.tmp
- sed -f ../intl/po2tbl.sed $(srcdir)/$(PACKAGE).pot \
- | sed -e "s/@PACKAGE NAME@/$(PACKAGE)/" > cat-id-tbl.tmp
- if cmp -s cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; then \
- rm cat-id-tbl.tmp; \
- else \
- echo cat-id-tbl.c changed; \
- rm -f $(srcdir)/cat-id-tbl.c; \
- mv cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; \
- fi
- cd $(srcdir) && rm -f stamp-cat-id && echo timestamp > stamp-cat-id
-
-
-install: install-exec install-data
-install-exec:
-install-data: install-data-yes
-install-data-no: all
-install-data-yes: all
- if test -r "$(MKINSTALLDIRS)"; then \
- $(MKINSTALLDIRS) $(datadir); \
- else \
- $(SHELL) $(top_srcdir)/mkinstalldirs $(datadir); \
- fi
- @catalogs='$(CATALOGS)'; \
- for cat in $$catalogs; do \
- cat=`basename $$cat`; \
- case "$$cat" in \
- *.gmo) destdir=$(gnulocaledir);; \
- *) destdir=$(localedir);; \
- esac; \
- lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
- dir=$$destdir/$$lang/LC_MESSAGES; \
- if test -r "$(MKINSTALLDIRS)"; then \
- $(MKINSTALLDIRS) $$dir; \
- else \
- $(SHELL) $(top_srcdir)/mkinstalldirs $$dir; \
- fi; \
- if test -r $$cat; then \
- $(INSTALL_DATA) $$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
- echo "installing $$cat as $$dir/$(PACKAGE)$(INSTOBJEXT)"; \
- else \
- $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
- echo "installing $(srcdir)/$$cat as" \
- "$$dir/$(PACKAGE)$(INSTOBJEXT)"; \
- fi; \
- if test -r $$cat.m; then \
- $(INSTALL_DATA) $$cat.m $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
- echo "installing $$cat.m as $$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
- else \
- if test -r $(srcdir)/$$cat.m ; then \
- $(INSTALL_DATA) $(srcdir)/$$cat.m \
- $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
- echo "installing $(srcdir)/$$cat as" \
- "$$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
- else \
- true; \
- fi; \
- fi; \
- done
- if test "$(PACKAGE)" = "gettext"; then \
- if test -r "$(MKINSTALLDIRS)"; then \
- $(MKINSTALLDIRS) $(gettextsrcdir); \
- else \
- $(SHELL) $(top_srcdir)/mkinstalldirs $(gettextsrcdir); \
- fi; \
- $(INSTALL_DATA) $(srcdir)/Makefile.in.in \
- $(gettextsrcdir)/Makefile.in.in; \
- else \
- : ; \
- fi
-
-# Define this as empty until I found a useful application.
-installcheck:
-
-uninstall:
- catalogs='$(CATALOGS)'; \
- for cat in $$catalogs; do \
- cat=`basename $$cat`; \
- lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
- rm -f $(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
- rm -f $(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
- rm -f $(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
- rm -f $(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
- done
- rm -f $(gettextsrcdir)/po-Makefile.in.in
-
-check: all
-
-cat-id-tbl.o: ../intl/libgettext.h
-
-dvi info tags TAGS ID:
-
-mostlyclean:
- rm -f core core.* *.pox $(PACKAGE).po *.old.po cat-id-tbl.tmp
- rm -fr *.o
-
-clean: mostlyclean
-
-distclean: clean
- rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m
-
-maintainer-clean: distclean
- @echo "This command is intended for maintainers to use;"
- @echo "it deletes files that may require special tools to rebuild."
- rm -f $(GMOFILES)
-
-distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
-dist distdir: update-po $(DISTFILES)
- dists="$(DISTFILES)"; \
- for file in $$dists; do \
- ln $(srcdir)/$$file $(distdir) 2> /dev/null \
- || cp -p $(srcdir)/$$file $(distdir); \
- done
-
-update-po: Makefile
- $(MAKE) $(PACKAGE).pot
- PATH=`pwd`/../src:$$PATH; \
- cd $(srcdir); \
- catalogs='$(CATALOGS)'; \
- for cat in $$catalogs; do \
- cat=`basename $$cat`; \
- lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
- mv $$lang.po $$lang.old.po; \
- echo "$$lang:"; \
- if $(MSGMERGE) $$lang.old.po $(PACKAGE).pot -o $$lang.po; then \
- rm -f $$lang.old.po; \
- else \
- echo "msgmerge for $$cat failed!"; \
- rm -f $$lang.po; \
- mv $$lang.old.po $$lang.po; \
- fi; \
- done
-
-POTFILES: POTFILES.in
- ( if test 'x$(srcdir)' != 'x.'; then \
- posrcprefix='$(top_srcdir)/'; \
- else \
- posrcprefix="../"; \
- fi; \
- rm -f $@-t $@ \
- && (sed -e '/^#/d' -e '/^[ ]*$$/d' \
- -e "s@.*@ $$posrcprefix& \\\\@" < $(srcdir)/$@.in \
- | sed -e '$$s/\\$$//') > $@-t \
- && chmod a-w $@-t \
- && mv $@-t $@ )
-
-Makefile: Makefile.in.in ../config.status POTFILES
- cd .. \
- && CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \
- $(SHELL) ./config.status
-
-# Tell versions [3.59,3.63) of GNU make not to export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
View
248 po/Makefile.in
@@ -1,248 +0,0 @@
-# Generated automatically from Makefile.in.in by configure.
-# Makefile for program source directory in GNU NLS utilities package.
-# Copyright (C) 1995, 1996, 1997 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
-#
-# This file file be copied and used freely without restrictions. It can
-# be used in projects which are not available under the GNU Public License
-# but which still want to provide support for the GNU gettext functionality.
-# Please note that the actual code is *not* freely available.
-
-PACKAGE = usbview
-VERSION = 0.1
-
-SHELL = /bin/sh
-
-
-srcdir = .
-top_srcdir = ..
-
-prefix = /usr/local
-exec_prefix = ${prefix}
-datadir = $(prefix)/share
-localedir = $(datadir)/locale
-gnulocaledir = $(prefix)/share/locale
-gettextsrcdir = $(prefix)/share/gettext/po
-subdir = po
-
-INSTALL = /usr/bin/install -c
-INSTALL_DATA = ${INSTALL} -m 644
-MKINSTALLDIRS = $(top_srcdir)/./mkinstalldirs
-
-CC = gcc
-GENCAT =
-GMSGFMT = PATH=../src:$$PATH /usr/bin/msgfmt
-MSGFMT = /usr/bin/msgfmt
-XGETTEXT = PATH=../src:$$PATH /usr/bin/xgettext
-MSGMERGE = PATH=../src:$$PATH msgmerge
-
-DEFS = -DHAVE_CONFIG_H
-CFLAGS = -g -O2 -Wall
-CPPFLAGS =
-
-INCLUDES = -I.. -I$(top_srcdir)/intl
-
-COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
-
-SOURCES = cat-id-tbl.c
-POFILES =
-GMOFILES =
-DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(PACKAGE).pot \
-stamp-cat-id $(POFILES) $(GMOFILES) $(SOURCES)
-
-POTFILES = \
-
-CATALOGS =
-CATOBJEXT = .gmo
-INSTOBJEXT = .mo
-
-.SUFFIXES:
-.SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat
-
-.c.o:
- $(COMPILE) $<
-
-.po.pox:
- $(MAKE) $(PACKAGE).pot
- $(MSGMERGE) $< $(srcdir)/$(PACKAGE).pot -o $*.pox
-
-.po.mo:
- $(MSGFMT) -o $@ $<
-
-.po.gmo:
- file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \
- && rm -f $$file && $(GMSGFMT) -o $$file $<
-
-.po.cat:
- sed -f ../intl/po2msg.sed < $< > $*.msg \
- && rm -f $@ && $(GENCAT) $@ $*.msg
-
-
-all: all-yes
-
-all-yes: cat-id-tbl.c $(CATALOGS)
-all-no:
-
-$(srcdir)/$(PACKAGE).pot: $(POTFILES)
- $(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(top_srcdir) \
- --add-comments --keyword=_ --keyword=N_ \
- --files-from=$(srcdir)/POTFILES.in \
- && test ! -f $(PACKAGE).po \
- || ( rm -f $(srcdir)/$(PACKAGE).pot \
- && mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot )
-
-$(srcdir)/cat-id-tbl.c: stamp-cat-id; @:
-$(srcdir)/stamp-cat-id: $(PACKAGE).pot
- rm -f cat-id-tbl.tmp
- sed -f ../intl/po2tbl.sed $(srcdir)/$(PACKAGE).pot \
- | sed -e "s/@PACKAGE NAME@/$(PACKAGE)/" > cat-id-tbl.tmp
- if cmp -s cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; then \
- rm cat-id-tbl.tmp; \
- else \
- echo cat-id-tbl.c changed; \
- rm -f $(srcdir)/cat-id-tbl.c; \
- mv cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; \
- fi
- cd $(srcdir) && rm -f stamp-cat-id && echo timestamp > stamp-cat-id
-
-
-install: install-exec install-data
-install-exec:
-install-data: install-data-yes
-install-data-no: all
-install-data-yes: all
- if test -r "$(MKINSTALLDIRS)"; then \
- $(MKINSTALLDIRS) $(datadir); \
- else \
- $(SHELL) $(top_srcdir)/mkinstalldirs $(datadir); \
- fi
- @catalogs='$(CATALOGS)'; \
- for cat in $$catalogs; do \
- cat=`basename $$cat`; \
- case "$$cat" in \
- *.gmo) destdir=$(gnulocaledir);; \
- *) destdir=$(localedir);; \
- esac; \
- lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
- dir=$$destdir/$$lang/LC_MESSAGES; \
- if test -r "$(MKINSTALLDIRS)"; then \
- $(MKINSTALLDIRS) $$dir; \
- else \
- $(SHELL) $(top_srcdir)/mkinstalldirs $$dir; \
- fi; \
- if test -r $$cat; then \
- $(INSTALL_DATA) $$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
- echo "installing $$cat as $$dir/$(PACKAGE)$(INSTOBJEXT)"; \
- else \
- $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
- echo "installing $(srcdir)/$$cat as" \
- "$$dir/$(PACKAGE)$(INSTOBJEXT)"; \
- fi; \
- if test -r $$cat.m; then \
- $(INSTALL_DATA) $$cat.m $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
- echo "installing $$cat.m as $$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
- else \
- if test -r $(srcdir)/$$cat.m ; then \
- $(INSTALL_DATA) $(srcdir)/$$cat.m \
- $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
- echo "installing $(srcdir)/$$cat as" \
- "$$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
- else \
- true; \
- fi; \
- fi; \
- done
- if test "$(PACKAGE)" = "gettext"; then \
- if test -r "$(MKINSTALLDIRS)"; then \
- $(MKINSTALLDIRS) $(gettextsrcdir); \
- else \
- $(SHELL) $(top_srcdir)/mkinstalldirs $(gettextsrcdir); \
- fi; \
- $(INSTALL_DATA) $(srcdir)/Makefile.in.in \
- $(gettextsrcdir)/Makefile.in.in; \
- else \
- : ; \
- fi
-
-# Define this as empty until I found a useful application.
-installcheck:
-
-uninstall:
- catalogs='$(CATALOGS)'; \
- for cat in $$catalogs; do \
- cat=`basename $$cat`; \
- lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
- rm -f $(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
- rm -f $(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
- rm -f $(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
- rm -f $(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
- done
- rm -f $(gettextsrcdir)/po-Makefile.in.in
-
-check: all
-
-cat-id-tbl.o: ../intl/libgettext.h
-
-dvi info tags TAGS ID:
-
-mostlyclean:
- rm -f core core.* *.pox $(PACKAGE).po *.old.po cat-id-tbl.tmp
- rm -fr *.o
-
-clean: mostlyclean
-
-distclean: clean
- rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m
-
-maintainer-clean: distclean
- @echo "This command is intended for maintainers to use;"
- @echo "it deletes files that may require special tools to rebuild."
- rm -f $(GMOFILES)
-
-distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
-dist distdir: update-po $(DISTFILES)
- dists="$(DISTFILES)"; \
- for file in $$dists; do \
- ln $(srcdir)/$$file $(distdir) 2> /dev/null \
- || cp -p $(srcdir)/$$file $(distdir); \
- done
-
-update-po: Makefile
- $(MAKE) $(PACKAGE).pot
- PATH=`pwd`/../src:$$PATH; \
- cd $(srcdir); \
- catalogs='$(CATALOGS)'; \
- for cat in $$catalogs; do \
- cat=`basename $$cat`; \
- lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
- mv $$lang.po $$lang.old.po; \
- echo "$$lang:"; \
- if $(MSGMERGE) $$lang.old.po $(PACKAGE).pot -o $$lang.po; then \
- rm -f $$lang.old.po; \
- else \
- echo "msgmerge for $$cat failed!"; \
- rm -f $$lang.po; \
- mv $$lang.old.po $$lang.po; \
- fi; \
- done
-
-POTFILES: POTFILES.in
- ( if test 'x$(srcdir)' != 'x.'; then \
- posrcprefix='$(top_srcdir)/'; \
- else \
- posrcprefix="../"; \
- fi; \
- rm -f $@-t $@ \
- && (sed -e '/^#/d' -e '/^[ ]*$$/d' \
- -e "s@.*@ $$posrcprefix& \\\\@" < $(srcdir)/$@.in \
- | sed -e '$$s/\\$$//') > $@-t \
- && chmod a-w $@-t \
- && mv $@-t $@ )
-
-Makefile: Makefile.in.in ../config.status POTFILES
- cd .. \
- && CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \
- $(SHELL) ./config.status
-
-# Tell versions [3.59,3.63) of GNU make not to export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
View
4 po/POTFILES
@@ -1,4 +0,0 @@
- ../src/main.c \
- ../src/interface.c \
- ../src/callbacks.c \
- ../src/support.c
View
1  po/stamp-cat-id
@@ -1 +0,0 @@
-timestamp
View
37 po/usbview.pot
@@ -1,37 +0,0 @@
-# SOME DESCRIPTIVE TITLE.
-# Copyright (C) YEAR Free Software Foundation, Inc.
-# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
-#
-#, fuzzy
-msgid ""
-msgstr ""
-"Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 1999-10-01 02:08-0700\n"
-"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
-"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
-"Language-Team: LANGUAGE <LL@li.org>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=CHARSET\n"
-"Content-Transfer-Encoding: ENCODING\n"
-
-#: src/interface.c:37
-msgid "USB Viewer"
-msgstr ""
-
-#: src/interface.c:90
-msgid "Refresh"
-msgstr ""
-
-#: src/interface.c:100
-msgid "Close"
-msgstr ""
-
-#: src/support.c:117
-#, c-format
-msgid "Couldn't find pixmap file: %s"
-msgstr ""
-
-#: src/support.c:126
-#, c-format
-msgid "Error loading pixmap file: %s"
-msgstr ""
View
518 src/usbtree.c
@@ -36,27 +36,92 @@
#include "usbtree.h"
#define MAX_LINE_SIZE 1000
+
+#define MAX_ENDPOINTS 32
+#define MAX_INTERFACES 8
+#define MAX_CONFIGS 8
#define MAX_CHILDREN 8
+#define DEVICE_VERSION_SIZE 6
+#define DEVICE_CLASS_SIZE 10
+#define DEVICE_SUBCLASS_SIZE 3
+#define DEVICE_PROTOCOL_SIZE 3
+#define DEVICE_VENDOR_ID_SIZE 5
+#define DEVICE_PRODUCT_ID_SIZE 5
+#define DEVICE_REVISION_NUMBER_SIZE 6
+
+#define CONFIG_ATTRIBUTES_SIZE 3
+#define CONFIG_MAXPOWER_SIZE 10
+
+#define INTERFACE_CLASS_SIZE 10
+#define INTERFACE_SUBCLASS_SIZE 3
+#define INTERFACE_PROTOCOL_SIZE 3
+
+#define ENDPOINT_TYPE_SIZE 5
+#define ENDPOINT_MAXPACKETSIZE_SIZE 5
+#define ENDPOINT_INTERVAL_SIZE 10
+
+typedef struct DeviceEndpoint {
+ gint address;
+ gboolean in; /* TRUE if in, FALSE if out */
+ gint attribute;
+ gchar *type;
+ gchar *maxPacketSize;
+ gchar *interval;
+} DeviceEndpoint;
+
+
+typedef struct DeviceInterface {
+ gint interfaceNumber;
+ gint alternateNumber;
+ gint numEndpoints;
+ gchar *class;
+ gchar *subClass;
+ gchar *protocol;
+ DeviceEndpoint *endpoint[MAX_ENDPOINTS];
+} DeviceInterface;
+
+
+
+typedef struct DeviceConfig {
+ gint configNumber;
+ gint numInterfaces;
+ gchar *attributes;
+ gchar *maxPower;
+ DeviceInterface *interface[MAX_INTERFACES];
+} DeviceConfig;
+
typedef struct Device {
char *name;
int level;
+ int parentNumber;
+ int portNumber;
int connectorNumber;
int count;
int deviceNumber;
int speed;
int interfaceNumber;
int maxChildren;
+ char *version;
+ char *class;
+ char *subClass;
+ char *protocol;
+ int maxPacketSize;
+ int numConfigs;
char *vendorId;
char *productId;
char *revisionNumber;
+ DeviceConfig *config[MAX_CONFIGS];
struct Device *parent;
struct Device *child[MAX_CHILDREN];
GtkWidget *tree;
GtkWidget *leaf;
} Device;
+
+
+
static Device *rootDevice = NULL;
static Device *lastDevice;
@@ -92,6 +157,60 @@ static signed int GetValue (char a, char b, char c)
}
+static void DestroyEndpoint (DeviceEndpoint *endpoint)
+{
+ if (endpoint == NULL)
+ return;
+
+ g_free (endpoint->type);
+ g_free (endpoint->maxPacketSize);
+ g_free (endpoint->interval);
+
+ g_free (endpoint);
+
+ return;
+}
+
+
+static void DestroyInterface (DeviceInterface *interface)
+{
+ int i;
+
+ if (interface == NULL)
+ return;
+
+ for (i = 0; i < MAX_ENDPOINTS; ++i)
+ DestroyEndpoint (interface->endpoint[i]);
+
+ g_free (interface->class);
+ g_free (interface->subClass);
+ g_free (interface->protocol);
+
+ g_free (interface);
+
+ return;
+}
+
+
+static void DestroyConfig (DeviceConfig *config)
+{
+ int i;
+
+ if (config == NULL)
+ return;
+
+ for (i = 0; i < MAX_INTERFACES; ++i)
+ DestroyInterface (config->interface[i]);
+
+ g_free (config->attributes);
+ g_free (config->maxPower);
+
+ g_free (config);
+
+ return;
+}
+
+
static void DestroyDevice (Device *device)
{
int i;
@@ -99,20 +218,22 @@ static void DestroyDevice (Device *device)
if (device == NULL)
return;
- for (i = 0; i < MAX_CHILDREN; ++i) {
+ for (i = 0; i < MAX_CHILDREN; ++i)
DestroyDevice (device->child[i]);
- }
- if (device->name)
- free (device->name);
- if (device->vendorId)
- free (device->vendorId);
- if (device->productId)
- free (device->productId);
- if (device->revisionNumber)
- free (device->revisionNumber);
+ for (i = 0; i < MAX_CONFIGS; ++i)
+ DestroyConfig (device->config[i]);
+
+ g_free (device->name);
+ g_free (device->version);
+ g_free (device->class);
+ g_free (device->subClass);
+ g_free (device->protocol);
+ g_free (device->vendorId);
+ g_free (device->productId);
+ g_free (device->revisionNumber);
- free (device);
+ g_free (device);
return;
}
@@ -127,8 +248,7 @@ static void Init (void)
rootDevice = NULL;
}
- rootDevice = (Device *)malloc (sizeof(Device));
- memset (rootDevice, 0x00, sizeof(Device));
+ rootDevice = (Device *)g_malloc0 (sizeof(Device));
/* blow away the tree */
gtk_tree_clear_items (GTK_TREE(treeUSB), 0, -1);
@@ -180,94 +300,105 @@ static Device *FindDevice (int deviceNumber)
static Device *AddDevice (char *line)
{
- Device *tempDevice;
- int level;
- int parentNumber;
- int portNumber;
- int count;
- int deviceNumber;
- int speed;
- int interfaceNumber;
- int maxChildren;
+ Device *device;
int nameLength;
- char *name;
+
+ /* create a new device */
+ device = (Device *)(g_malloc0 (sizeof(Device)));
/* parse the line */
- level = GetValue (' ', line[8], line[9]);
- parentNumber = GetValue (' ', line[16], line[17]);
- portNumber = GetValue (' ', line[24], line[25]);
- count = GetValue (' ', line[31], line[32]);
- deviceNumber = GetValue (line[39], line[40], line[41]);
- speed = GetValue (line[47], line[48], line[49]);
- interfaceNumber = GetValue (line[55], line[56], line[57]);
- maxChildren = GetValue (' ', line[64], line[65]);
+ /* parsing in C sucks, I could do this a zillion different ways, but this
+ is good enough for now. */
+ device->level = GetValue (' ', line[8], line[9]);
+ device->parentNumber = GetValue (' ', line[16], line[17]);
+ device->portNumber = GetValue (' ', line[24], line[25]);
+ device->count = GetValue (' ', line[31], line[32]);
+ device->deviceNumber = GetValue (line[39], line[40], line[41]);
+ device->speed = GetValue (line[47], line[48], line[49]);
+ device->interfaceNumber = GetValue (line[55], line[56], line[57]);
+ device->maxChildren = GetValue (' ', line[64], line[65]);
nameLength = strlen (&line[74])+1;
- name = (char *)malloc(nameLength);
- strncpy (name, &line[74], nameLength);
- name[nameLength-2] = 0x00;
+ device->name = (char *)g_malloc0 (nameLength);
+ strncpy (device->name, &line[74], nameLength);
+ device->name[nameLength-2] = 0x00;
+ if (device->deviceNumber == -1)
+ device->deviceNumber = 0;
+
/* printf ("%i %i %i %i %i %i %i %i %s\n", level, parentNumber, portNumber, count, deviceNumber, speed, interfaceNumber, maxChildren, name); */
- tempDevice = (Device *)(malloc (sizeof(Device)));
- memset (tempDevice, 0x00, sizeof(Device));
-
/* Set up the parent / child relationship */
- if (level == 0) {
+ if (device->level == 0) {
/* this is the root, don't go looking for a parent */
- tempDevice->parent = rootDevice;
+ device->parent = rootDevice;
rootDevice->maxChildren = 1;
- rootDevice->child[0] = tempDevice;
+ rootDevice->child[0] = device;
}
else {
/* need to find this device's parent */
- tempDevice->parent = FindDevice (parentNumber);
- if (tempDevice->parent == NULL) {
+ device->parent = FindDevice (device->parentNumber);
+ if (device->parent == NULL) {
printf ("can't find parent...not good.\n");
}
- tempDevice->parent->child[portNumber] = tempDevice;
+ device->parent->child[device->portNumber] = device;
}
- /* fill up the driver's fields */
- if (deviceNumber == -1)
- deviceNumber = 0;
- tempDevice->deviceNumber = deviceNumber;
- tempDevice->name = name;
- tempDevice->speed = speed;
- tempDevice->maxChildren = maxChildren;
-
- return (tempDevice);
+
+ return (device);
}
-#define VENDOR_ID_SIZE 5
-#define PRODUCT_ID_SIZE 5
-#define REVISION_NUMBER_SIZE 6
-void GetMoreDeviceInformation (Device *device, char *data)
+
+
+static void GetDeviceInformation (Device *device, char *data)
{
if (device == NULL)
return;
/* ok, this is a hack, I "should" turn the id's into the raw number, but for now,
let's just stick with the string representation */
- if (device->vendorId)
- free (device->vendorId);
- if (device->productId)
- free (device->productId);
- if (device->revisionNumber)
- free (device->revisionNumber);
+ g_free (device->version);
+ g_free (device->class);
+ g_free (device->subClass);
+ g_free (device->protocol);
+
+ device->version = (char *)g_malloc0 ((DEVICE_VERSION_SIZE) * sizeof(char));
+ device->class = (char *)g_malloc0 ((DEVICE_CLASS_SIZE) * sizeof(char));
+ device->subClass = (char *)g_malloc0 ((DEVICE_SUBCLASS_SIZE) * sizeof(char));
+ device->protocol = (char *)g_malloc0 ((DEVICE_PROTOCOL_SIZE) * sizeof(char));
+
+ memcpy (device->version, &data[8], DEVICE_VERSION_SIZE-1);
+ memcpy (device->class, &data[18], DEVICE_CLASS_SIZE-1);
+ memcpy (device->subClass, &data[32], DEVICE_SUBCLASS_SIZE-1);
+ memcpy (device->protocol, &data[40], DEVICE_PROTOCOL_SIZE-1);
+
+ device->maxPacketSize = GetValue (' ', data[48], data[49]);
+ device->numConfigs = GetValue (data[57], data[58], data[59]);
- device->vendorId = (char *)malloc ((VENDOR_ID_SIZE) * sizeof(char));
- device->productId = (char *)malloc ((PRODUCT_ID_SIZE) * sizeof(char));
- device->revisionNumber = (char *)malloc ((REVISION_NUMBER_SIZE) * sizeof(char));
+ return;
+}
- memset (device->vendorId, 0x00, VENDOR_ID_SIZE);
- memset (device->productId, 0x00, PRODUCT_ID_SIZE);
- memset (device->revisionNumber, 0x00, REVISION_NUMBER_SIZE);
-
- memcpy (device->vendorId, &data[11], VENDOR_ID_SIZE-1);
- memcpy (device->productId, &data[23], PRODUCT_ID_SIZE-1);
- memcpy (device->revisionNumber, &data[32], REVISION_NUMBER_SIZE-1);
+
+
+static void GetMoreDeviceInformation (Device *device, char *data)
+{
+ if (device == NULL)
+ return;
+
+ /* ok, this is a hack, I "should" turn the id's into the raw number, but for now,
+ let's just stick with the string representation */
+ g_free (device->vendorId);
+ g_free (device->productId);
+ g_free (device->revisionNumber);
+
+ device->vendorId = (char *)g_malloc0 ((DEVICE_VENDOR_ID_SIZE) * sizeof(char));
+ device->productId = (char *)g_malloc0 ((DEVICE_PRODUCT_ID_SIZE) * sizeof(char));
+ device->revisionNumber = (char *)g_malloc0 ((DEVICE_REVISION_NUMBER_SIZE) * sizeof(char));
+
+ memcpy (device->vendorId, &data[11], DEVICE_VENDOR_ID_SIZE-1);
+ memcpy (device->productId, &data[23], DEVICE_PRODUCT_ID_SIZE-1);
+ memcpy (device->revisionNumber, &data[32], DEVICE_REVISION_NUMBER_SIZE-1);
/* printf ("%s\t%s\t%s\n", device->vendorId, device->productId, device->revisionNumber); */
@@ -275,12 +406,179 @@ void GetMoreDeviceInformation (Device *device, char *data)
}
+static void AddConfig (Device *device, char *data)
+{
+ DeviceConfig *config;
+ int i;
+
+ if (device == NULL)
+ return;
-void PopulateListBox (int deviceNumber)
+ /* Find the next available config in this device */
+ for (i = 0; i < MAX_CONFIGS; ++i) {
+ if (device->config[i] == NULL) {
+ break;
+ }
+ }
+ if (i >= MAX_CONFIGS) {
+ /* ran out of room to hold this config */
+ g_warning ("Too many configs for this device.\n");
+ return;
+ }
+
+ config = (DeviceConfig *)g_malloc0 (sizeof(DeviceConfig));
+ config->attributes = (gchar *)g_malloc0 ((CONFIG_ATTRIBUTES_SIZE) * sizeof(gchar));
+ config->maxPower = (gchar *)g_malloc0 ((CONFIG_MAXPOWER_SIZE) * sizeof(gchar));
+
+ config->numInterfaces = GetValue (' ', data[9], data[10]);
+ config->configNumber = GetValue (' ', data[17], data[18]);
+
+ memcpy (config->attributes, &data[24], CONFIG_ATTRIBUTES_SIZE-1);
+ data[strlen(data)-1] = 0x00;
+ strncpy (config->maxPower, &data[33], CONFIG_MAXPOWER_SIZE-1);
+
+ /* have the device now point to this config */
+ device->config[i] = config;
+
+ return;
+}
+
+
+static void AddInterface (Device *device, char *data)
+{
+ DeviceConfig *config;
+ DeviceInterface *interface;
+ int i;
+ int configNum;
+
+ if (device == NULL)
+ return;
+
+ /* find the LAST config in the device */
+ configNum = -1;
+ for (i = 0; i < MAX_CONFIGS; ++i)
+ if (device->config[i])
+ configNum = i;
+ if (configNum == -1) {
+ /* no config to put this interface at, not good */
+ g_warning ("No config to put an interface at for this device.\n");
+ return;
+ }
+
+ config = device->config[configNum];
+
+ /* now find a place in this config to place the interface */
+ for (i = 0; i < MAX_INTERFACES; ++i)
+ if (config->interface[i] == NULL)
+ break;
+ if (i >= MAX_INTERFACES) {
+ /* ran out of room to hold this interface */
+ g_warning ("Too many interfaces for this device.\n");
+ return;
+ }
+
+ interface = (DeviceInterface *)g_malloc0 (sizeof(DeviceInterface));
+
+ interface->class = (gchar *)g_malloc0 ((INTERFACE_CLASS_SIZE) * sizeof(gchar));
+ interface->subClass = (gchar *)g_malloc0 ((INTERFACE_SUBCLASS_SIZE) * sizeof(gchar));
+ interface->protocol = (gchar *)g_malloc0 ((INTERFACE_PROTOCOL_SIZE) * sizeof(gchar));
+
+ interface->interfaceNumber = GetValue (' ', data[8], data[9]);
+ interface->alternateNumber = GetValue (' ', data[15], data[16]);
+ interface->numEndpoints = GetValue (' ', data[23], data[24]);
+
+ memcpy (interface->class, &data[30], INTERFACE_CLASS_SIZE-1);
+ memcpy (interface->subClass, &data[44], INTERFACE_SUBCLASS_SIZE-1);
+ memcpy (interface->protocol, &data[52], INTERFACE_PROTOCOL_SIZE-1);
+
+ /* now point the config to this interface */
+ config->interface[i] = interface;
+
+ return;
+}
+
+
+static void AddEndpoint (Device *device, char *data)
+{
+ DeviceConfig *config;
+ DeviceInterface *interface;
+ DeviceEndpoint *endpoint;
+ int i;
+ int configNum;
+ int interfaceNum;
+
+ if (device == NULL)
+ return;
+
+ /* find the LAST config in the device */
+ configNum = -1;
+ for (i = 0; i < MAX_CONFIGS; ++i)
+ if (device->config[i])
+ configNum = i;
+ if (configNum == -1) {
+ /* no config to put this interface at, not good */
+ g_warning ("No config to put an interface at for this device.\n");
+ return;
+ }
+
+ config = device->config[configNum];
+
+ /* find the LAST interface in the config */
+ interfaceNum = -1;
+ for (i = 0; i < MAX_INTERFACES; ++i)
+ if (config->interface[i])
+ interfaceNum = i;
+ if (interfaceNum == -1) {
+ /* no interface to put this endpoint at, not good */
+ g_warning ("No interface to put an endpoint at for this device.\n");
+ return;
+ }
+
+ interface = config->interface[interfaceNum];
+
+ /* now find a place in this interface to place the endpoint */
+ for (i = 0; i < MAX_ENDPOINTS; ++i) {
+ if (interface->endpoint[i] == NULL) {
+ break;
+ }
+ }
+ if (i >= MAX_ENDPOINTS) {
+ /* ran out of room to hold this endpoint */
+ g_warning ("Too many endpoints for this device.\n");
+ return;
+ }
+
+ endpoint = (DeviceEndpoint *)g_malloc0 (sizeof(DeviceEndpoint));
+
+ endpoint->type = (gchar *)g_malloc0 ((ENDPOINT_TYPE_SIZE) * sizeof(gchar));
+ endpoint->maxPacketSize = (gchar *)g_malloc0 ((ENDPOINT_MAXPACKETSIZE_SIZE) * sizeof(gchar));
+ endpoint->interval = (gchar *)g_malloc0 ((ENDPOINT_INTERVAL_SIZE) * sizeof(gchar));
+
+ endpoint->address = GetValue (' ', data[7], data[8]); /* not too good, this is a hex number...as most are...hmm...*/
+ if (data[10] == 'I')
+ endpoint->in = TRUE;
+ else
+ endpoint->in = FALSE;
+ endpoint->attribute = GetValue (' ', data[17], data[18]);
+
+ memcpy (endpoint->type, &data[20], ENDPOINT_TYPE_SIZE-1);
+ memcpy (endpoint->maxPacketSize, &data[31], ENDPOINT_MAXPACKETSIZE_SIZE-1);
+ data[strlen(data)-1] = 0x00;
+ strncpy (endpoint->interval, &data[40], ENDPOINT_INTERVAL_SIZE-1);
+
+ /* point the interface to the endpoint */
+ interface->endpoint[i] = endpoint;
+}
+
+
+static void PopulateListBox (int deviceNumber)
{
Device *device;
gint position = 0;
char *string;
+ int configNum;
+ int interfaceNum;
+ int endpointNum;
device = FindDevice (deviceNumber);
if (device == NULL) {
@@ -291,7 +589,7 @@ void PopulateListBox (int deviceNumber)
/* clear the textbox */
gtk_editable_delete_text (GTK_EDITABLE(textDescription), 0, -1);
- string = (char *)malloc (1000);
+ string = (char *)g_malloc (1000);
/* add the name to the textbox */
gtk_editable_insert_text (GTK_EDITABLE(textDescription), device->name, strlen(device->name), &position);
@@ -307,15 +605,65 @@ void PopulateListBox (int deviceNumber)
gtk_editable_insert_text (GTK_EDITABLE(textDescription), string, strlen(string), &position);
}
+ /* add the USB version, device class, subclass, protocol, max packet size, and the number of configurations (if it is there) */
+ if (device->version) {
+ sprintf (string, "\nUSB Version: %s\nDevice Class: %s\nDevice Subclass: %s\nDevice Protocol: %s\n"
+ "Maximum Default Endpoint Size: %i\nNumber of Configurations: %i",
+ device->version, device->class, device->subClass, device->protocol,
+ device->maxPacketSize, device->numConfigs);
+ gtk_editable_insert_text (GTK_EDITABLE(textDescription), string, strlen(string), &position);
+ }
+
/* add the vendor id, product id, and revision number (if it is there) */
if (device->vendorId) {
- sprintf (string, "\nVendor Id: %s\tProduct Id: %s\tRevision Number: %s",
+ sprintf (string, "\nVendor Id: %s\nProduct Id: %s\nRevision Number: %s",
device->vendorId, device->productId, device->revisionNumber);
-
gtk_editable_insert_text (GTK_EDITABLE(textDescription), string, strlen(string), &position);
}
- free (string);
+ /* display all the info for the configs */
+ for (configNum = 0; configNum < MAX_CONFIGS; ++configNum) {
+ if (device->config[configNum]) {
+ DeviceConfig *config = device->config[configNum];
+
+ /* show this config */
+ sprintf (string, "\n\nConfig Number: %i\n\tNumber of Interfaces: %i\n\t"
+ "Attributes: %s\n\tMaxPower Needed: %s",
+ config->configNumber, config->numInterfaces,
+ config->attributes, config->maxPower);
+ gtk_editable_insert_text (GTK_EDITABLE(textDescription), string, strlen(string), &position);
+
+ /* show all of the interfaces for this config */
+ for (interfaceNum = 0; interfaceNum < MAX_INTERFACES; ++interfaceNum) {
+ if (config->interface[interfaceNum]) {
+ DeviceInterface *interface = config->interface[interfaceNum];
+
+ sprintf (string, "\n\n\tInterface Number: %i\n\t\tAlternate Number: %i\n\t\t"
+ "Class: %s\n\t\tSub Class: %s\n\t\tProtocol: %s\n\t\tNumber of Endpoints: %i",
+ interface->interfaceNumber, interface->alternateNumber,
+ interface->class, interface->subClass, interface->protocol, interface->numEndpoints);
+ gtk_editable_insert_text (GTK_EDITABLE(textDescription), string, strlen(string), &position);
+
+ /* show all of the endpoints for this interface */
+ for (endpointNum = 0; endpointNum < MAX_ENDPOINTS; ++endpointNum) {
+ if (interface->endpoint[endpointNum]) {
+ DeviceEndpoint *endpoint = interface->endpoint[endpointNum];
+
+ sprintf (string, "\n\n\t\t\tEndpoint Address: %i\n\t\t\t"
+ "Direction: %s\n\t\t\tAttribute: %i\n\t\t\t"
+ "Type: %s\n\t\t\tMax Packet Size: %s\n\t\t\tInterval: %s",
+ endpoint->address,
+ endpoint->in ? "in" : "out", endpoint->attribute,
+ endpoint->type, endpoint->maxPacketSize, endpoint->interval);
+ gtk_editable_insert_text (GTK_EDITABLE(textDescription), string, strlen(string), &position);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ g_free (string);
return;
}
@@ -380,6 +728,7 @@ static void ParseLine (char * line)
break;
case 'D': /* device information */
+ GetDeviceInformation (lastDevice, line);
break;
case 'P': /* more device information */
@@ -387,8 +736,17 @@ static void ParseLine (char * line)
break;
case 'C': /* config descriptor info */
+ AddConfig (lastDevice, line);
+ break;
+
case 'I': /* interface descriptor info */
+ AddInterface (lastDevice, line);
+ break;
+
case 'E': /* endpoint descriptor info */
+ AddEndpoint (lastDevice, line);
+ break;
+
default:
break;
}
@@ -413,17 +771,19 @@ void LoadUSBTree (void)
finished = 0;
Init();
- dataLine = (char *)malloc (MAX_LINE_SIZE);
+ dataLine = (char *)g_malloc (MAX_LINE_SIZE);
while (!finished) {
/* read the line in from the file */
fgets (dataLine, MAX_LINE_SIZE, usbFile);
- ParseLine (dataLine);
+ if (dataLine[strlen(dataLine)-1] == '\n')
+ ParseLine (dataLine);
if (feof (usbFile))
finished = 1;
}
+ g_free (dataLine);
DisplayDevice (rootDevice, rootDevice->child[0]);
Please sign in to comment.
Something went wrong with that request. Please try again.