00001 #ifndef __INCLUDED_DEBUG_H__
00002 #define __INCLUDED_DEBUG_H__
00003
00004 #ifndef HID_INTERNAL
00005 # error "this file is only supposed to be used from within libhid."
00006 #endif
00007
00008 #include <hid.h>
00009 #include <usb.h>
00010
00011 extern HIDDebugLevel hid_debug_level;
00012 extern FILE* hid_debug_stream;
00013
00014 #define DEBUGPRINTF(t, s, a...) if (hid_debug_stream) { \
00015 fprintf(hid_debug_stream, "%s: %s(): ", t, __FUNCTION__); \
00016 fprintf(hid_debug_stream, s "\n", ##a); \
00017 }
00018 #define TRACE(s, a...) if (hid_debug_level & HID_DEBUG_TRACES) { DEBUGPRINTF(" TRACE", s, ##a) }
00019 #define NOTICE(s, a...) if (hid_debug_level & HID_DEBUG_NOTICES) { DEBUGPRINTF(" NOTICE", s, ##a) }
00020 #define WARNING(s, a...) if (hid_debug_level & HID_DEBUG_WARNINGS) { DEBUGPRINTF("WARNING", s, ##a) }
00021 #define ERROR(s, a...) if (hid_debug_level & HID_DEBUG_ERRORS) { DEBUGPRINTF(" ERROR", s, ##a) }
00022
00023 void trace_usb_bus(FILE* const out, struct usb_bus const* const usbbus);
00024 void trace_usb_device(FILE* const out, struct usb_device const* const usbdev);
00025 void trace_usb_device_descriptor(FILE* const out, struct usb_device_descriptor const* const descriptor);
00026 void trace_usb_config_descriptor(FILE* const out, struct usb_config_descriptor const* const config);
00027 void trace_usb_dev_handle(FILE* const out, usb_dev_handle const* const usbdev_h);
00028
00029 #endif
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044