X-Git-Url: http://cvs.zerfleddert.de/cgi-bin/gitweb.cgi/rigol/blobdiff_plain/0926876978e80ae1e9c29d9f33a8f8ec0babaf5e..ddf9f28b7fcb36da063e26102f7f97190e4158c8:/usbtmc.c diff --git a/usbtmc.c b/usbtmc.c index 622ea80..835b6c8 100644 --- a/usbtmc.c +++ b/usbtmc.c @@ -8,6 +8,14 @@ #define USB_TIMEOUT 50000 +#if BYTE_ORDER == LITTLE_ENDIAN +#define LE32(x) x +#elif BYTE_ORDER == BIG_ENDIAN +#define LE32(x) ((uint32_t)((((uint32_t)x)>>24) | ((((uint32_t)x)>>8) & 0xff00) | ((((uint32_t)x)<<8) & 0xff0000) | (((uint32_t)x)<<24))) +#else +#error BYTE_ORDER not defined/known! +#endif + //Helper-routine: Convert a little-endian 4-byte word to an int static void int2chars(unsigned char *buff,unsigned int a) { buff[3]=(a>>24)&0xff; @@ -126,8 +134,7 @@ usb_dev_handle* usbtmc_initscope(void) { //Locate and open the scope dev = usbtmc_find_scope(); if (!dev) { - printf("No scope found.\n"); - exit(1); + return NULL; } usbtmc_claim(dev); //The following code isn't really necessary, the program works