diff options
author | cnlohr <lohr85@gmail.com> | 2016-11-30 02:10:28 -0500 |
---|---|---|
committer | cnlohr <lohr85@gmail.com> | 2016-11-30 02:10:28 -0500 |
commit | 1d0a3ef8b28e212eda4735da66f2f26e6c1a7cc5 (patch) | |
tree | 855a316ba979742543dd5122faaa80c7b50ba498 /src/survive_internal.h | |
parent | 8388ca81fbc6c0a840e81f6fd805b897d378556b (diff) | |
download | libsurvive-1d0a3ef8b28e212eda4735da66f2f26e6c1a7cc5.tar.gz libsurvive-1d0a3ef8b28e212eda4735da66f2f26e6c1a7cc5.tar.bz2 |
I'm learning.
Diffstat (limited to 'src/survive_internal.h')
-rw-r--r-- | src/survive_internal.h | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/survive_internal.h b/src/survive_internal.h index b29b25b..70249e3 100644 --- a/src/survive_internal.h +++ b/src/survive_internal.h @@ -7,7 +7,7 @@ #include <libusb-1.0/libusb.h> #define SV_INFO( x... ) printf( x ) -#define SV_ERROR( x... ) fprintf( stderr, x ) +#define SV_ERROR( x... ) { char stbuff[1024]; sprintf( stbuff, x ); ctx->faultfunction( ctx, stbuff ); } //XXX TODO This one needs to be rewritten. #define SV_KILL() exit(0) @@ -31,9 +31,6 @@ struct SurviveContext; struct SurviveUSBInterface; - -//XXX TODO: Roll this into the main structure. - typedef void (*usb_callback)( struct SurviveUSBInterface * ti ); struct SurviveUSBInterface @@ -43,21 +40,29 @@ struct SurviveUSBInterface int actual_len; uint8_t buffer[INTBUFFSIZE]; usb_callback cb; - int which_interface_am_i; - const char * hname; //human names + int which_interface_am_i; //for indexing into uiface + const char * hname; //human-readable names }; struct SurviveContext { + //USB Subsystem struct libusb_context* usbctx; + void(*faultfunction)( struct SurviveContext * ctx, const char * fault ); struct libusb_device_handle * udev[MAX_USB_DEVS]; struct SurviveUSBInterface uiface[MAX_INTERFACES]; }; + +//USB Subsystem + void survive_usb_close( struct SurviveContext * t ); int survive_usb_init( struct SurviveContext * t ); int survive_usb_poll( struct SurviveContext * ctx ); +//Accept Data from backend. +void survive_data_cb( struct SurviveUSBInterface * si ); + #endif |