00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
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