usbinfo.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2010 Vojtech Horky
00003  * All rights reserved.
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions
00007  * are met:
00008  *
00009  * - Redistributions of source code must retain the above copyright
00010  *   notice, this list of conditions and the following disclaimer.
00011  * - Redistributions in binary form must reproduce the above copyright
00012  *   notice, this list of conditions and the following disclaimer in the
00013  *   documentation and/or other materials provided with the distribution.
00014  * - The name of the author may not be used to endorse or promote products
00015  *   derived from this software without specific prior written permission.
00016  *
00017  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
00018  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00019  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
00020  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
00021  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
00022  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00023  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00024  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00025  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
00026  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00027  */
00028 
00035 #ifndef USBINFO_USBINFO_H_
00036 #define USBINFO_USBINFO_H_
00037 
00038 #include <usb/usb.h>
00039 #include <usb/descriptor.h>
00040 #include <usb/dev/pipes.h>
00041 #include <usb/debug.h>
00042 #include <usb/dev/dp.h>
00043 #include <ipc/devman.h>
00044 
00045 typedef struct {
00046         usb_pipe_t ctrl_pipe;
00047         usb_device_connection_t wire;
00048         usb_standard_device_descriptor_t device_descriptor;
00049         uint8_t *full_configuration_descriptor;
00050         size_t full_configuration_descriptor_size;
00051 } usbinfo_device_t;
00052 
00053 typedef struct {
00054         int opt;
00055         void (*action)(usbinfo_device_t *dev);
00056         bool active;
00057 } usbinfo_action_t;
00058 
00059 
00060 #define NAME "usbinfo"
00061 
00062 void dump_buffer(const char *, size_t, const uint8_t *, size_t);
00063 const char *get_indent(size_t);
00064 void dump_match_ids(match_id_list_t *, const char *);
00065 void dump_usb_descriptor(uint8_t *, size_t);
00066 void dump_descriptor_tree(uint8_t *, size_t);
00067 
00068 static inline void internal_error(int err)
00069 {
00070         fprintf(stderr, NAME ": internal error (%s).\n", str_error(err));
00071 }
00072 
00073 usbinfo_device_t *prepare_device(const char *, devman_handle_t, usb_address_t);
00074 void destroy_device(usbinfo_device_t *);
00075 
00076 typedef void (*dump_descriptor_in_tree_t)(uint8_t *, size_t, void *);
00077 void browse_descriptor_tree(uint8_t *, size_t, usb_dp_descriptor_nesting_t *,
00078     dump_descriptor_in_tree_t, size_t, void *);
00079 
00080 
00081 void dump_short_device_identification(usbinfo_device_t *);
00082 void dump_device_match_ids(usbinfo_device_t *);
00083 void dump_descriptor_tree_brief(usbinfo_device_t *);
00084 void dump_descriptor_tree_full(usbinfo_device_t *);
00085 void dump_strings(usbinfo_device_t *);
00086 void dump_status(usbinfo_device_t *);
00087 
00088 
00089 #endif
00090 

Generated on Thu Jun 2 07:45:43 2011 for HelenOS/USB by  doxygen 1.4.7