From 7b48d6e104fd461b0c12519b70dbd1c6c72824e1 Mon Sep 17 00:00:00 2001 From: Uwe Hermann Date: Fri, 17 Feb 2012 19:40:01 +0100 Subject: [PATCH] sr: Prefix log messages with subsystem string. --- hardware/alsa/alsa.c | 26 +++++----- hardware/asix-sigma/asix-sigma.c | 51 +++++++++---------- hardware/common/ezusb.c | 26 +++++----- hardware/link-mso19/link-mso19.c | 43 ++++++++-------- hardware/saleae-logic/saleae-logic.c | 66 +++++++++++++------------ hardware/zeroplus-logic-cube/gl_usb.c | 12 ++--- hardware/zeroplus-logic-cube/zeroplus.c | 36 ++++++++------ input/chronovu_la8.c | 18 +++---- output/analog.c | 6 ++- output/text/ascii.c | 3 +- output/text/bits.c | 3 +- output/vcd.c | 2 +- session.c | 3 +- session_driver.c | 23 ++++----- session_file.c | 16 +++--- 15 files changed, 175 insertions(+), 159 deletions(-) diff --git a/hardware/alsa/alsa.c b/hardware/alsa/alsa.c index b6dd66c4..ffd6778d 100644 --- a/hardware/alsa/alsa.c +++ b/hardware/alsa/alsa.c @@ -104,22 +104,22 @@ static int hw_opendev(int device_index) err = snd_pcm_open(&alsa->capture_handle, AUDIO_DEV, SND_PCM_STREAM_CAPTURE, 0); if (err < 0) { - sr_err("cannot open audio device %s (%s)", AUDIO_DEV, + sr_err("alsa: can't open audio device %s (%s)", AUDIO_DEV, snd_strerror(err)); return SR_ERR; } err = snd_pcm_hw_params_malloc(&alsa->hw_params); if (err < 0) { - sr_err("cannot allocate hardware parameter structure (%s)", + sr_err("alsa: can't allocate hardware parameter structure (%s)", snd_strerror(err)); return SR_ERR; } err = snd_pcm_hw_params_any(alsa->capture_handle, alsa->hw_params); if (err < 0) { - sr_err("cannot initialize hardware parameter structure (%s)", - snd_strerror(err)); + sr_err("alsa: can't initialize hardware parameter structure " + "(%s)", snd_strerror(err)); return SR_ERR; } @@ -251,7 +251,7 @@ static int receive_data(int fd, int revents, void *user_data) count = snd_pcm_readi(alsa->capture_handle, inb, MIN(4096/4, alsa->limit_samples)); if (count < 1) { - sr_err("Failed to read samples"); + sr_err("alsa: Failed to read samples"); return FALSE; } @@ -306,7 +306,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id) err = snd_pcm_hw_params_set_access(alsa->capture_handle, alsa->hw_params, SND_PCM_ACCESS_RW_INTERLEAVED); if (err < 0) { - sr_err("cannot set access type (%s)", snd_strerror(err)); + sr_err("alsa: can't set access type (%s)", snd_strerror(err)); return SR_ERR; } @@ -314,40 +314,40 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id) err = snd_pcm_hw_params_set_format(alsa->capture_handle, alsa->hw_params, SND_PCM_FORMAT_S16_LE); if (err < 0) { - sr_err("cannot set sample format (%s)", snd_strerror(err)); + sr_err("alsa: can't set sample format (%s)", snd_strerror(err)); return SR_ERR; } err = snd_pcm_hw_params_set_rate_near(alsa->capture_handle, alsa->hw_params, (unsigned int *) &alsa->cur_rate, 0); if (err < 0) { - sr_err("cannot set sample rate (%s)", snd_strerror(err)); + sr_err("alsa: can't set sample rate (%s)", snd_strerror(err)); return SR_ERR; } err = snd_pcm_hw_params_set_channels(alsa->capture_handle, alsa->hw_params, NUM_PROBES); if (err < 0) { - sr_err("cannot set channel count (%s)", snd_strerror(err)); + sr_err("alsa: can't set channel count (%s)", snd_strerror(err)); return SR_ERR; } err = snd_pcm_hw_params(alsa->capture_handle, alsa->hw_params); if (err < 0) { - sr_err("cannot set parameters (%s)", snd_strerror(err)); + sr_err("alsa: can't set parameters (%s)", snd_strerror(err)); return SR_ERR; } err = snd_pcm_prepare(alsa->capture_handle); if (err < 0) { - sr_err("cannot prepare audio interface for use (%s)", + sr_err("alsa: can't prepare audio interface for use (%s)", snd_strerror(err)); return SR_ERR; } count = snd_pcm_poll_descriptors_count(alsa->capture_handle); if (count < 1) { - sr_err("Unable to obtain poll descriptors count"); + sr_err("alsa: Unable to obtain poll descriptors count"); return SR_ERR; } @@ -358,7 +358,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id) err = snd_pcm_poll_descriptors(alsa->capture_handle, ufds, count); if (err < 0) { - sr_err("Unable to obtain poll descriptors (%s)", + sr_err("alsa: Unable to obtain poll descriptors (%s)", snd_strerror(err)); g_free(ufds); return SR_ERR; diff --git a/hardware/asix-sigma/asix-sigma.c b/hardware/asix-sigma/asix-sigma.c index 5aed8756..d2a7b6e8 100644 --- a/hardware/asix-sigma/asix-sigma.c +++ b/hardware/asix-sigma/asix-sigma.c @@ -126,7 +126,7 @@ static int sigma_read(void *buf, size_t size, struct sigma *sigma) ret = ftdi_read_data(&sigma->ftdic, (unsigned char *)buf, size); if (ret < 0) { - sr_err("ftdi_read_data failed: %s", + sr_err("sigma: ftdi_read_data failed: %s", ftdi_get_error_string(&sigma->ftdic)); } @@ -139,10 +139,10 @@ static int sigma_write(void *buf, size_t size, struct sigma *sigma) ret = ftdi_write_data(&sigma->ftdic, (unsigned char *)buf, size); if (ret < 0) { - sr_err("ftdi_write_data failed: %s", + sr_err("sigma: ftdi_write_data failed: %s", ftdi_get_error_string(&sigma->ftdic)); } else if ((size_t) ret != size) { - sr_err("ftdi_write_data did not complete write\n"); + sr_err("sigma: ftdi_write_data did not complete write\n"); } return ret; @@ -190,7 +190,7 @@ static uint8_t sigma_get_register(uint8_t reg, struct sigma *sigma) uint8_t value; if (1 != sigma_read_register(reg, &value, 1, sigma)) { - sr_err("sigma_get_register: 1 byte expected"); + sr_err("sigma: sigma_get_register: 1 byte expected"); return 0; } @@ -337,12 +337,12 @@ static int bin2bitbang(const char *filename, f = g_fopen(filename, "rb"); if (!f) { - sr_err("g_fopen(\"%s\", \"rb\")", filename); + sr_err("sigma: g_fopen(\"%s\", \"rb\")", filename); return SR_ERR; } if (-1 == fseek(f, 0, SEEK_END)) { - sr_err("fseek on %s failed", filename); + sr_err("sigma: fseek on %s failed", filename); fclose(f); return SR_ERR; } @@ -376,7 +376,8 @@ static int bin2bitbang(const char *filename, if (ret < 0) { g_free(compressed_buf); g_free(firmware); - sr_err("Could not unpack Sigma firmware. (Error %d)\n", ret); + sr_err("sigma: Could not unpack Sigma firmware. " + "(Error %d)\n", ret); return SR_ERR; } @@ -404,7 +405,7 @@ static int bin2bitbang(const char *filename, if (offset != *buf_size) { g_free(*buf); - sr_err("Error reading firmware %s " + sr_err("sigma: Error reading firmware %s " "offset=%ld, file_size=%ld, buf_size=%zd\n", filename, offset, file_size, *buf_size); @@ -474,20 +475,20 @@ static int upload_firmware(int firmware_idx, struct sigma *sigma) /* Make sure it's an ASIX SIGMA. */ if ((ret = ftdi_usb_open_desc(&sigma->ftdic, USB_VENDOR, USB_PRODUCT, USB_DESCRIPTION, NULL)) < 0) { - sr_err("ftdi_usb_open failed: %s", + sr_err("sigma: ftdi_usb_open failed: %s", ftdi_get_error_string(&sigma->ftdic)); return 0; } if ((ret = ftdi_set_bitmode(&sigma->ftdic, 0xdf, BITMODE_BITBANG)) < 0) { - sr_err("ftdi_set_bitmode failed: %s", + sr_err("sigma: ftdi_set_bitmode failed: %s", ftdi_get_error_string(&sigma->ftdic)); return 0; } /* Four times the speed of sigmalogan - Works well. */ if ((ret = ftdi_set_baudrate(&sigma->ftdic, 750000)) < 0) { - sr_err("ftdi_set_baudrate failed: %s", + sr_err("sigma: ftdi_set_baudrate failed: %s", ftdi_get_error_string(&sigma->ftdic)); return 0; } @@ -515,7 +516,7 @@ static int upload_firmware(int firmware_idx, struct sigma *sigma) firmware_files[firmware_idx]); if ((ret = bin2bitbang(firmware_path, &buf, &buf_size)) != SR_OK) { - sr_err("An error occured while reading the firmware: %s", + sr_err("sigma: An error occured while reading the firmware: %s", firmware_path); return ret; } @@ -526,7 +527,7 @@ static int upload_firmware(int firmware_idx, struct sigma *sigma) g_free(buf); if ((ret = ftdi_set_bitmode(&sigma->ftdic, 0x00, BITMODE_RESET)) < 0) { - sr_err("ftdi_set_bitmode failed: %s", + sr_err("sigma: ftdi_set_bitmode failed: %s", ftdi_get_error_string(&sigma->ftdic)); return SR_ERR; } @@ -544,7 +545,7 @@ static int upload_firmware(int firmware_idx, struct sigma *sigma) ret = sigma_read(result, 3, sigma); if (ret != 3 || result[0] != 0xa6 || result[1] != 0x55 || result[2] != 0xaa) { - sr_err("Configuration failed. Invalid reply received."); + sr_err("sigma: Configuration failed. Invalid reply received."); return SR_ERR; } @@ -568,7 +569,7 @@ static int hw_opendev(int device_index) if ((ret = ftdi_usb_open_desc(&sigma->ftdic, USB_VENDOR, USB_PRODUCT, USB_DESCRIPTION, NULL)) < 0) { - sr_err("ftdi_usb_open failed: %s", + sr_err("sigma: ftdi_usb_open failed: %s", ftdi_get_error_string(&sigma->ftdic)); return 0; @@ -610,7 +611,7 @@ static int set_samplerate(struct sr_device_instance *sdi, sigma->samples_per_event = 16 / sigma->num_probes; sigma->state.state = SIGMA_IDLE; - sr_info("Firmware uploaded"); + sr_info("sigma: Firmware uploaded"); return ret; } @@ -643,7 +644,7 @@ static int configure_probes(struct sr_device_instance *sdi, GSList *probes) if (sigma->cur_samplerate >= SR_MHZ(100)) { /* Fast trigger support. */ if (trigger_set) { - sr_err("ASIX SIGMA only supports a single " + sr_err("sigma: ASIX SIGMA only supports a single " "pin trigger in 100 and 200MHz mode."); return SR_ERR; } @@ -652,7 +653,7 @@ static int configure_probes(struct sr_device_instance *sdi, GSList *probes) else if (probe->trigger[0] == 'r') sigma->trigger.risingmask |= probebit; else { - sr_err("ASIX SIGMA only supports " + sr_err("sigma: ASIX SIGMA only supports " "rising/falling trigger in 100 " "and 200MHz mode."); return SR_ERR; @@ -684,8 +685,8 @@ static int configure_probes(struct sr_device_instance *sdi, GSList *probes) * does not permit ORed triggers. */ if (trigger_set > 1) { - sr_err("ASIX SIGMA only supports 1 rising/" - "falling triggers."); + sr_err("sigma: ASIX SIGMA only supports 1 " + "rising/falling triggers."); return SR_ERR; } } @@ -731,7 +732,7 @@ static int hw_cleanup(void) for (l = device_instances; l; l = l->next) { if (!(sdi = l->data)) { /* Log error, but continue cleaning up the rest. */ - sr_err("asix: %s: sdi was NULL, continuing", __func__); + sr_err("sigma: %s: sdi was NULL, continuing", __func__); ret = SR_ERR_BUG; continue; } @@ -750,7 +751,7 @@ static void *hw_get_device_info(int device_index, int device_info_id) void *info = NULL; if (!(sdi = sr_dev_inst_get(device_instances, device_index))) { - sr_err("It's NULL.\n"); + sr_err("sigma: %s: sdi was NULL", __func__); return NULL; } @@ -1051,7 +1052,7 @@ static int receive_data(int fd, int revents, void *session_data) newchunks = MIN(chunks_per_read, numchunks - sigma->state.chunks_downloaded); - sr_info("Downloading sample data: %.0f %%", + sr_info("sigma: Downloading sample data: %.0f %%", 100.0 * sigma->state.chunks_downloaded / numchunks); bufsz = sigma_read_dram(sigma->state.chunks_downloaded, @@ -1378,12 +1379,12 @@ static int hw_stop_acquisition(int device_index, gpointer session_data) (void)session_data; if (!(sdi = sr_dev_inst_get(device_instances, device_index))) { - sr_err("asix: %s: sdi was NULL", __func__); + sr_err("sigma: %s: sdi was NULL", __func__); return SR_ERR_BUG; } if (!(sigma = sdi->priv)) { - sr_err("asix: %s: sdi->priv was NULL", __func__); + sr_err("sigma: %s: sdi->priv was NULL", __func__); return SR_ERR_BUG; } diff --git a/hardware/common/ezusb.c b/hardware/common/ezusb.c index 6a4f3297..cb0c74e0 100644 --- a/hardware/common/ezusb.c +++ b/hardware/common/ezusb.c @@ -35,12 +35,13 @@ SR_PRIV int ezusb_reset(struct libusb_device_handle *hdl, int set_clear) int err; unsigned char buf[1]; - sr_info("setting CPU reset mode %s...", set_clear ? "on" : "off"); + sr_info("ezusb: setting CPU reset mode %s...", + set_clear ? "on" : "off"); buf[0] = set_clear ? 1 : 0; err = libusb_control_transfer(hdl, LIBUSB_REQUEST_TYPE_VENDOR, 0xa0, 0xe600, 0x0000, buf, 1, 100); if (err < 0) - sr_err("Unable to send control request: %d", err); + sr_err("ezusb: Unable to send control request: %d", err); return err; } @@ -52,9 +53,9 @@ SR_PRIV int ezusb_install_firmware(libusb_device_handle *hdl, int offset, chunksize, err, result; unsigned char buf[4096]; - sr_info("Uploading firmware at %s", filename); + sr_info("ezusb: Uploading firmware at %s", filename); if ((fw = g_fopen(filename, "rb")) == NULL) { - sr_err("Unable to open firmware file %s for reading: %s", + sr_err("ezusb: Unable to open firmware file %s for reading: %s", filename, strerror(errno)); return SR_ERR; } @@ -69,15 +70,16 @@ SR_PRIV int ezusb_install_firmware(libusb_device_handle *hdl, LIBUSB_ENDPOINT_OUT, 0xa0, offset, 0x0000, buf, chunksize, 100); if (err < 0) { - sr_err("Unable to send firmware to device: %d", err); + sr_err("ezusb: Unable to send firmware to device: %d", + err); result = SR_ERR; break; } - sr_info("Uploaded %d bytes", chunksize); + sr_info("ezusb: Uploaded %d bytes", chunksize); offset += chunksize; } fclose(fw); - sr_info("Firmware upload done"); + sr_info("ezusb: Firmware upload done"); return result; } @@ -88,11 +90,11 @@ SR_PRIV int ezusb_upload_firmware(libusb_device *dev, int configuration, struct libusb_device_handle *hdl; int err; - sr_info("uploading firmware to device on %d.%d", - libusb_get_bus_number(dev), libusb_get_device_address(dev)); + sr_info("ezusb: uploading firmware to device on %d.%d", + libusb_get_bus_number(dev), libusb_get_device_address(dev)); if ((err = libusb_open(dev, &hdl)) < 0) { - sr_err("failed to open device: %d", err); + sr_err("ezusb: failed to open device: %d", err); return SR_ERR; } @@ -100,14 +102,14 @@ SR_PRIV int ezusb_upload_firmware(libusb_device *dev, int configuration, #if !defined(_WIN32) && !defined(__APPLE__) if (libusb_kernel_driver_active(hdl, 0)) { if ((err = libusb_detach_kernel_driver(hdl, 0)) < 0) { - sr_err("failed to detach kernel driver: %d", err); + sr_err("ezusb: failed to detach kernel driver: %d", err); return SR_ERR; } } #endif if ((err = libusb_set_configuration(hdl, configuration)) < 0) { - sr_err("Unable to set configuration: %d", err); + sr_err("ezusb: Unable to set configuration: %d", err); return SR_ERR; } diff --git a/hardware/link-mso19/link-mso19.c b/hardware/link-mso19/link-mso19.c index ed310b0b..f663fe35 100644 --- a/hardware/link-mso19/link-mso19.c +++ b/hardware/link-mso19/link-mso19.c @@ -146,7 +146,7 @@ static int mso_reset_adc(struct sr_device_instance *sdi) ops[1] = mso_trans(REG_CTL1, mso->ctlbase1); mso->ctlbase1 |= BIT_CTL1_ADC_UNKNOWN4; - sr_dbg("Requesting ADC reset"); + sr_dbg("mso19: Requesting ADC reset"); return mso_send_control_message(sdi, ARRAY_AND_SIZE(ops)); } @@ -158,7 +158,7 @@ static int mso_reset_fsm(struct sr_device_instance *sdi) mso->ctlbase1 |= BIT_CTL1_RESETFSM; ops[0] = mso_trans(REG_CTL1, mso->ctlbase1); - sr_dbg("Requesting ADC reset"); + sr_dbg("mso19: Requesting ADC reset"); return mso_send_control_message(sdi, ARRAY_AND_SIZE(ops)); } @@ -172,7 +172,7 @@ static int mso_toggle_led(struct sr_device_instance *sdi, int state) mso->ctlbase1 |= BIT_CTL1_LED; ops[0] = mso_trans(REG_CTL1, mso->ctlbase1); - sr_dbg("Requesting LED toggle"); + sr_dbg("mso19: Requesting LED toggle"); return mso_send_control_message(sdi, ARRAY_AND_SIZE(ops)); } @@ -183,7 +183,7 @@ static int mso_check_trigger(struct sr_device_instance *sdi, char buf[1]; int ret; - sr_dbg("Requesting trigger state"); + sr_dbg("mso19: Requesting trigger state"); ret = mso_send_control_message(sdi, ARRAY_AND_SIZE(ops)); if (info == NULL || ret != SR_OK) return ret; @@ -193,7 +193,7 @@ static int mso_check_trigger(struct sr_device_instance *sdi, ret = SR_ERR; *info = buf[0]; - sr_dbg("Trigger state is: 0x%x", *info); + sr_dbg("mso19: Trigger state is: 0x%x", *info); return ret; } @@ -201,7 +201,7 @@ static int mso_read_buffer(struct sr_device_instance *sdi) { uint16_t ops[] = { mso_trans(REG_BUFFER, 0) }; - sr_dbg("Requesting buffer dump"); + sr_dbg("mso19: Requesting buffer dump"); return mso_send_control_message(sdi, ARRAY_AND_SIZE(ops)); } @@ -214,7 +214,7 @@ static int mso_arm(struct sr_device_instance *sdi) mso_trans(REG_CTL1, mso->ctlbase1), }; - sr_dbg("Requesting trigger arm"); + sr_dbg("mso19: Requesting trigger arm"); return mso_send_control_message(sdi, ARRAY_AND_SIZE(ops)); } @@ -226,7 +226,7 @@ static int mso_force_capture(struct sr_device_instance *sdi) mso_trans(REG_CTL1, mso->ctlbase1), }; - sr_dbg("Requesting forced capture"); + sr_dbg("mso19: Requesting forced capture"); return mso_send_control_message(sdi, ARRAY_AND_SIZE(ops)); } @@ -239,7 +239,7 @@ static int mso_dac_out(struct sr_device_instance *sdi, uint16_t val) mso_trans(REG_CTL1, mso->ctlbase1 | BIT_CTL1_RESETADC), }; - sr_dbg("Setting dac word to 0x%x", val); + sr_dbg("mso19: Setting dac word to 0x%x", val); return mso_send_control_message(sdi, ARRAY_AND_SIZE(ops)); } @@ -250,7 +250,7 @@ static int mso_clkrate_out(struct sr_device_instance *sdi, uint16_t val) mso_trans(REG_CLKRATE2, val & 0xff), }; - sr_dbg("Setting clkrate word to 0x%x", val); + sr_dbg("mso19: Setting clkrate word to 0x%x", val); return mso_send_control_message(sdi, ARRAY_AND_SIZE(ops)); } @@ -416,7 +416,7 @@ static int hw_init(const char *deviceinfo) */ udev = udev_new(); if (!udev) { - sr_err("Failed to initialize udev."); + sr_err("mso19: Failed to initialize udev."); goto ret; } enumerate = udev_enumerate_new(udev); @@ -436,7 +436,7 @@ static int hw_init(const char *deviceinfo) parent = udev_device_get_parent_with_subsystem_devtype( dev, "usb", "usb_device"); if (!parent) { - sr_err("Unable to find parent usb device for %s", + sr_err("mso19: Unable to find parent usb device for %s", sysname); continue; } @@ -455,7 +455,7 @@ static int hw_init(const char *deviceinfo) s = strcspn(iProduct, " "); if (s > sizeof(product) || strlen(iProduct) - s > sizeof(manufacturer)) { - sr_err("Could not parse iProduct: %s", iProduct); + sr_err("mso19: Could not parse iProduct: %s", iProduct); continue; } strncpy(product, iProduct, s); @@ -468,7 +468,7 @@ static int hw_init(const char *deviceinfo) } if (mso_parse_serial(iSerial, iProduct, mso) != SR_OK) { - sr_err("Invalid iSerial: %s", iSerial); + sr_err("mso19: Invalid iSerial: %s", iSerial); goto err_free_mso; } sprintf(hwrev, "r%d", mso->hwrev); @@ -478,8 +478,7 @@ static int hw_init(const char *deviceinfo) { /* Initialize the protocol trigger configuration */ int i; - for (i = 0; i < 4; i++) - { + for (i = 0; i < 4; i++) { mso->protocol_trigger.word[i] = 0; mso->protocol_trigger.mask[i] = 0xff; } @@ -487,9 +486,9 @@ static int hw_init(const char *deviceinfo) } sdi = sr_dev_inst_new(devcnt, SR_ST_INITIALIZING, - manufacturer, product, hwrev); + manufacturer, product, hwrev); if (!sdi) { - sr_err("Unable to create device instance for %s", + sr_err("mso19: Unable to create device instance for %s", sysname); goto err_free_mso; } @@ -566,20 +565,20 @@ static int hw_opendev(int device_index) /* FIXME: discard serial buffer */ mso_check_trigger(sdi, &mso->trigger_state); - sr_dbg("trigger state: 0x%x", mso->trigger_state); + sr_dbg("mso19: trigger state: 0x%x", mso->trigger_state); ret = mso_reset_adc(sdi); if (ret != SR_OK) return ret; mso_check_trigger(sdi, &mso->trigger_state); - sr_dbg("trigger state: 0x%x", mso->trigger_state); + sr_dbg("mso19: trigger state: 0x%x", mso->trigger_state); // ret = mso_reset_fsm(sdi); // if (ret != SR_OK) // return ret; - sr_dbg("Finished %s", __func__); + sr_dbg("mso19: Finished %s", __func__); // return SR_ERR; return SR_OK; @@ -601,7 +600,7 @@ static int hw_closedev(int device_index) sdi->status = SR_ST_INACTIVE; } - sr_dbg("finished %s", __func__); + sr_dbg("mso19: finished %s", __func__); return SR_OK; } diff --git a/hardware/saleae-logic/saleae-logic.c b/hardware/saleae-logic/saleae-logic.c index 42884715..35662821 100644 --- a/hardware/saleae-logic/saleae-logic.c +++ b/hardware/saleae-logic/saleae-logic.c @@ -185,11 +185,12 @@ static int sl_open_device(int device_index) libusb_get_device_list(usb_context, &devlist); for (i = 0; devlist[i]; i++) { if ((err = libusb_get_device_descriptor(devlist[i], &des))) { - sr_err("failed to get device descriptor: %d", err); + sr_err("logic: failed to get device descriptor: %d", err); continue; } - if (des.idVendor != fx2->profile->fw_vid || des.idProduct != fx2->profile->fw_pid) + if (des.idVendor != fx2->profile->fw_vid + || des.idProduct != fx2->profile->fw_pid) continue; if (sdi->status == SR_ST_INITIALIZING) { @@ -200,8 +201,8 @@ static int sl_open_device(int device_index) } } else if (sdi->status == SR_ST_INACTIVE) { /* - * This device is fully enumerated, so we need to find this - * device by vendor, product, bus and address. + * This device is fully enumerated, so we need to find + * this device by vendor, product, bus and address. */ if (libusb_get_bus_number(devlist[i]) != fx2->usb->bus || libusb_get_device_address(devlist[i]) != fx2->usb->address) @@ -218,11 +219,11 @@ static int sl_open_device(int device_index) fx2->usb->address = libusb_get_device_address(devlist[i]); sdi->status = SR_ST_ACTIVE; - sr_info("saleae: opened device %d on %d.%d interface %d", - sdi->index, fx2->usb->bus, - fx2->usb->address, USB_INTERFACE); + sr_info("logic: opened device %d on %d.%d interface %d", + sdi->index, fx2->usb->bus, + fx2->usb->address, USB_INTERFACE); } else { - sr_err("failed to open device: %d", err); + sr_err("logic: failed to open device: %d", err); } /* if we made it here, we handled the device one way or another */ @@ -245,7 +246,7 @@ static void close_device(struct sr_device_instance *sdi) if (fx2->usb->devhdl == NULL) return; - sr_info("saleae: closing device %d on %d.%d interface %d", sdi->index, + sr_info("logic: closing device %d on %d.%d interface %d", sdi->index, fx2->usb->bus, fx2->usb->address, USB_INTERFACE); libusb_release_interface(fx2->usb->devhdl, USB_INTERFACE); libusb_close(fx2->usb->devhdl); @@ -304,7 +305,7 @@ static struct fx2_device *fx2_device_new(void) struct fx2_device *fx2; if (!(fx2 = g_try_malloc0(sizeof(struct fx2_device)))) { - sr_err("saleae: %s: fx2 malloc failed", __func__); + sr_err("logic: %s: fx2 malloc failed", __func__); return NULL; } fx2->trigger_stage = TRIGGER_FIRED; @@ -331,7 +332,7 @@ static int hw_init(const char *deviceinfo) (void)deviceinfo; if (libusb_init(&usb_context) != 0) { - sr_err("Failed to initialize USB."); + sr_err("logic: Failed to initialize USB."); return 0; } @@ -342,7 +343,8 @@ static int hw_init(const char *deviceinfo) fx2_prof = NULL; err = libusb_get_device_descriptor(devlist[i], &des); if (err != 0) { - sr_err("failed to get device descriptor: %d", err); + sr_err("logic: failed to get device descriptor: %d", + err); continue; } @@ -368,7 +370,7 @@ static int hw_init(const char *deviceinfo) if (check_conf_profile(devlist[i])) { /* Already has the firmware, so fix the new address. */ - sr_dbg("Found a Saleae Logic with %s firmware.", + sr_dbg("logic: Found a Saleae Logic with %s firmware.", new_saleae_logic_firmware ? "new" : "old"); sdi->status = SR_ST_INACTIVE; fx2->usb = sr_usb_dev_inst_new @@ -379,7 +381,8 @@ static int hw_init(const char *deviceinfo) /* Remember when the firmware on this device was updated */ g_get_current_time(&fx2->fw_updated); else - sr_err("firmware upload failed for device %d", devcnt); + sr_err("logic: firmware upload failed for " + "device %d", devcnt); fx2->usb = sr_usb_dev_inst_new (libusb_get_bus_number(devlist[i]), 0xff, NULL); } @@ -407,31 +410,31 @@ static int hw_opendev(int device_index) */ err = 0; if (GTV_TO_MSEC(fx2->fw_updated) > 0) { - sr_info("saleae: waiting for device to reset"); + sr_info("logic: waiting for device to reset"); /* takes at least 300ms for the FX2 to be gone from the USB bus */ - g_usleep(300*1000); + g_usleep(300 * 1000); timediff = 0; while (timediff < MAX_RENUM_DELAY) { if ((err = sl_open_device(device_index)) == SR_OK) break; - g_usleep(100*1000); + g_usleep(100 * 1000); g_get_current_time(&cur_time); timediff = GTV_TO_MSEC(cur_time) - GTV_TO_MSEC(fx2->fw_updated); } - sr_info("saleae: device came back after %d ms", timediff); + sr_info("logic: device came back after %d ms", timediff); } else { err = sl_open_device(device_index); } if (err != SR_OK) { - sr_err("unable to open device"); + sr_err("logic: unable to open device"); return SR_ERR; } fx2 = sdi->priv; err = libusb_claim_interface(fx2->usb->devhdl, USB_INTERFACE); if (err != 0) { - sr_err("Unable to claim interface: %d", err); + sr_err("logic: Unable to claim interface: %d", err); return SR_ERR; } @@ -471,13 +474,13 @@ static int hw_cleanup(void) for (l = device_instances; l; l = l->next) { if (!(sdi = l->data)) { /* Log error, but continue cleaning up the rest. */ - sr_err("fx2: %s: sdi was NULL, continuing", __func__); + sr_err("logic: %s: sdi was NULL, continuing", __func__); ret = SR_ERR_BUG; continue; } if (!(fx2 = sdi->priv)) { /* Log error, but continue cleaning up the rest. */ - sr_err("fx2: %s: sdi->priv was NULL, continuing", + sr_err("logic: %s: sdi->priv was NULL, continuing", __func__); ret = SR_ERR_BUG; continue; @@ -583,7 +586,7 @@ static uint8_t new_firmware_divider_value(uint64_t samplerate) } /* Shouldn't happen. */ - sr_err("saleae: %s: Invalid samplerate %" PRIu64 "", + sr_err("logic: %s: Invalid samplerate %" PRIu64 "", __func__, samplerate); return 0; } @@ -609,7 +612,7 @@ static int set_configuration_samplerate(struct sr_device_instance *sdi, else divider = (uint8_t) (48 / (samplerate / 1000000.0)) - 1; - sr_info("saleae: setting samplerate to %" PRIu64 " Hz (divider %d)", + sr_info("logic: setting samplerate to %" PRIu64 " Hz (divider %d)", samplerate, divider); buf[0] = (new_saleae_logic_firmware) ? 0xd5 : 0x01; @@ -617,7 +620,7 @@ static int set_configuration_samplerate(struct sr_device_instance *sdi, ret = libusb_bulk_transfer(fx2->usb->devhdl, 1 | LIBUSB_ENDPOINT_OUT, buf, 2, &result, 500); if (ret != 0) { - sr_err("failed to set samplerate: %d", ret); + sr_err("logic: failed to set samplerate: %d", ret); return SR_ERR; } fx2->cur_samplerate = samplerate; @@ -692,7 +695,7 @@ static void receive_transfer(struct libusb_transfer *transfer) return; } - sr_info("saleae: receive_transfer(): status %d received %d bytes", + sr_info("logic: receive_transfer(): status %d received %d bytes", transfer->status, transfer->actual_length); /* Save incoming transfer before reusing the transfer struct. */ @@ -702,7 +705,7 @@ static void receive_transfer(struct libusb_transfer *transfer) /* Fire off a new request. */ if (!(new_buf = g_try_malloc(4096))) { - sr_err("saleae: %s: new_buf malloc failed", __func__); + sr_err("logic: %s: new_buf malloc failed", __func__); return; /* TODO: SR_ERR_MALLOC */ } @@ -710,7 +713,8 @@ static void receive_transfer(struct libusb_transfer *transfer) transfer->length = 4096; if (libusb_submit_transfer(transfer) != 0) { /* TODO: Stop session? */ - sr_err("eek"); + /* TODO: Better error message. */ + sr_err("logic: %s: libusb_submit_transfer error", __func__); } if (cur_buflen == 0) { @@ -821,12 +825,12 @@ static int hw_start_acquisition(int device_index, gpointer session_data) fx2->session_data = session_data; if (!(packet = g_try_malloc(sizeof(struct sr_datafeed_packet)))) { - sr_err("saleae: %s: packet malloc failed", __func__); + sr_err("logic: %s: packet malloc failed", __func__); return SR_ERR_MALLOC; } if (!(header = g_try_malloc(sizeof(struct sr_datafeed_header)))) { - sr_err("saleae: %s: header malloc failed", __func__); + sr_err("logic: %s: header malloc failed", __func__); return SR_ERR_MALLOC; } @@ -834,7 +838,7 @@ static int hw_start_acquisition(int device_index, gpointer session_data) size = 2048; for (i = 0; i < NUM_SIMUL_TRANSFERS; i++) { if (!(buf = g_try_malloc(size))) { - sr_err("saleae: %s: buf malloc failed", __func__); + sr_err("logic: %s: buf malloc failed", __func__); return SR_ERR_MALLOC; } transfer = libusb_alloc_transfer(0); diff --git a/hardware/zeroplus-logic-cube/gl_usb.c b/hardware/zeroplus-logic-cube/gl_usb.c index f8323226..0156a3d1 100644 --- a/hardware/zeroplus-logic-cube/gl_usb.c +++ b/hardware/zeroplus-logic-cube/gl_usb.c @@ -58,7 +58,7 @@ static int gl_write_address(libusb_device_handle *devh, unsigned int address) ret = libusb_control_transfer(devh, CTRL_OUT, 0xc, REQ_WRITEADDR, 0, packet, 1, TIMEOUT); if (ret != 1) - sr_err("%s: libusb_control_transfer returned %d\n", + sr_err("zp: %s: libusb_control_transfer returned %d\n", __func__, ret); return ret; } @@ -71,7 +71,7 @@ static int gl_write_data(libusb_device_handle *devh, unsigned int val) ret = libusb_control_transfer(devh, CTRL_OUT, 0xc, REQ_WRITEDATA, 0, packet, 1, TIMEOUT); if (ret != 1) - sr_err("%s: libusb_control_transfer returned %d\n", + sr_err("zp: %s: libusb_control_transfer returned %d\n", __func__, ret); return ret; } @@ -84,8 +84,8 @@ static int gl_read_data(libusb_device_handle *devh) ret = libusb_control_transfer(devh, CTRL_IN, 0xc, REQ_READDATA, 0, packet, 1, TIMEOUT); if (ret != 1) - sr_err("%s: libusb_control_transfer returned %d, val=%hhx\n", - __func__, ret, packet[0]); + sr_err("zp: %s: libusb_control_transfer returned %d, " + "val=%hhx\n", __func__, ret, packet[0]); return (ret == 1) ? packet[0] : ret; } @@ -100,13 +100,13 @@ SR_PRIV int gl_read_bulk(libusb_device_handle *devh, void *buffer, ret = libusb_control_transfer(devh, CTRL_OUT, 0x4, REQ_READBULK, 0, packet, 8, TIMEOUT); if (ret != 8) - sr_err("%s: libusb_control_transfer returned %d\n", + sr_err("zp: %s: libusb_control_transfer returned %d\n", __func__, ret); ret = libusb_bulk_transfer(devh, EP1_BULK_IN, buffer, size, &transferred, TIMEOUT); if (ret < 0) - sr_err("Bulk read error %d\n", ret); + sr_err("zp: Bulk read error %d\n", ret); return transferred; } diff --git a/hardware/zeroplus-logic-cube/zeroplus.c b/hardware/zeroplus-logic-cube/zeroplus.c index deea5ae4..d0b8b806 100644 --- a/hardware/zeroplus-logic-cube/zeroplus.c +++ b/hardware/zeroplus-logic-cube/zeroplus.c @@ -197,7 +197,7 @@ static int opendev4(struct sr_device_instance **sdi, libusb_device *dev, } if ((err = libusb_get_device_descriptor(dev, des))) { - sr_err("failed to get device descriptor: %d", err); + sr_err("zp: failed to get device descriptor: %d", err); return -1; } @@ -211,26 +211,27 @@ static int opendev4(struct sr_device_instance **sdi, libusb_device *dev, if (!(des->idProduct == zeroplus_models[i].pid)) continue; - sr_info("Found PID=%04X (%s)", des->idProduct, - zeroplus_models[i].model_name); + sr_info("zp: Found ZeroPlus device 0x%04x (%s)", + des->idProduct, zeroplus_models[i].model_name); zp->num_channels = zeroplus_models[i].channels; zp->memory_size = zeroplus_models[i].sample_depth * 1024; break; } if (zp->num_channels == 0) { - sr_err("Unknown ZeroPlus device %04X", des->idProduct); + sr_err("zp: Unknown ZeroPlus device 0x%04x", + des->idProduct); return -2; } /* Found it. */ if (!(err = libusb_open(dev, &(zp->usb->devhdl)))) { (*sdi)->status = SR_ST_ACTIVE; - sr_info("opened device %d on %d.%d interface %d", + sr_info("zp: opened device %d on %d.%d interface %d", (*sdi)->index, zp->usb->bus, zp->usb->address, USB_INTERFACE); } else { - sr_err("failed to open device: %d", err); + sr_err("zp: failed to open device: %d", err); *sdi = NULL; } } @@ -280,7 +281,7 @@ static void close_device(struct sr_device_instance *sdi) if (!zp->usb->devhdl) return; - sr_info("closing device %d on %d.%d interface %d", sdi->index, + sr_info("zp: closing device %d on %d.%d interface %d", sdi->index, zp->usb->bus, zp->usb->address, USB_INTERFACE); libusb_release_interface(zp->usb->devhdl, USB_INTERFACE); libusb_reset_device(zp->usb->devhdl); @@ -363,7 +364,7 @@ static int hw_init(const char *deviceinfo) // memset(zp->trigger_buffer, 0, NUM_TRIGGER_STAGES); if (libusb_init(&usb_context) != 0) { - sr_err("Failed to initialize USB."); + sr_err("zp: Failed to initialize USB."); return 0; } @@ -374,7 +375,7 @@ static int hw_init(const char *deviceinfo) for (i = 0; devlist[i]; i++) { err = libusb_get_device_descriptor(devlist[i], &des); if (err != 0) { - sr_err("failed to get device descriptor: %d", err); + sr_err("zp: failed to get device descriptor: %d", err); continue; } @@ -416,7 +417,7 @@ static int hw_opendev(int device_index) int err; if (!(sdi = zp_open_device(device_index))) { - sr_err("unable to open device"); + sr_err("zp: unable to open device"); return SR_ERR; } @@ -436,7 +437,7 @@ static int hw_opendev(int device_index) err = libusb_claim_interface(zp->usb->devhdl, USB_INTERFACE); if (err != 0) { - sr_err("Unable to claim interface: %d", err); + sr_err("zp: Unable to claim interface: %d", err); return SR_ERR; } @@ -654,12 +655,15 @@ static int hw_start_acquisition(int device_index, gpointer session_data) analyzer_configure(zp->usb->devhdl); analyzer_start(zp->usb->devhdl); - sr_info("Waiting for data"); + sr_info("zp: Waiting for data"); analyzer_wait_data(zp->usb->devhdl); - sr_info("Stop address = 0x%x", analyzer_get_stop_address(zp->usb->devhdl)); - sr_info("Now address = 0x%x", analyzer_get_now_address(zp->usb->devhdl)); - sr_info("Trigger address = 0x%x", analyzer_get_trigger_address(zp->usb->devhdl)); + sr_info("zp: Stop address = 0x%x", + analyzer_get_stop_address(zp->usb->devhdl)); + sr_info("zp: Now address = 0x%x", + analyzer_get_now_address(zp->usb->devhdl)); + sr_info("zp: Trigger address = 0x%x", + analyzer_get_trigger_address(zp->usb->devhdl)); packet.type = SR_DF_HEADER; packet.payload = &header; @@ -680,7 +684,7 @@ static int hw_start_acquisition(int device_index, gpointer session_data) for (packet_num = 0; packet_num < (zp->memory_size * 4 / PACKET_SIZE); packet_num++) { res = analyzer_read_data(zp->usb->devhdl, buf, PACKET_SIZE); - sr_info("Tried to read %llx bytes, actually read %x bytes", + sr_info("zp: Tried to read %llx bytes, actually read %x bytes", PACKET_SIZE, res); packet.type = SR_DF_LOGIC; diff --git a/input/chronovu_la8.c b/input/chronovu_la8.c index 10653073..875b52bc 100644 --- a/input/chronovu_la8.c +++ b/input/chronovu_la8.c @@ -49,20 +49,20 @@ static uint64_t divcount_to_samplerate(uint8_t divcount) static int format_match(const char *filename) { if (!filename) { - sr_err("la8input: %s: filename was NULL", __func__); + sr_err("la8 in: %s: filename was NULL", __func__); // return SR_ERR; /* FIXME */ return FALSE; } if (!g_file_test(filename, G_FILE_TEST_EXISTS)) { - sr_err("la8input: %s: input file '%s' does not exist", + sr_err("la8 in: %s: input file '%s' does not exist", __func__, filename); // return SR_ERR; /* FIXME */ return FALSE; } if (!g_file_test(filename, G_FILE_TEST_IS_REGULAR)) { - sr_err("la8input: %s: input file '%s' not a regular file", + sr_err("la8 in: %s: input file '%s' not a regular file", __func__, filename); // return SR_ERR; /* FIXME */ return FALSE; @@ -83,7 +83,7 @@ static int init(struct sr_input *in) if (in->param && in->param[0]) { num_probes = strtoul(in->param, NULL, 10); if (num_probes < 1) { - sr_err("la8input: %s: strtoul failed", __func__); + sr_err("la8 in: %s: strtoul failed", __func__); return SR_ERR; } } else { @@ -113,7 +113,7 @@ static int loadfile(struct sr_input *in, const char *filename) /* TODO: Use glib functions! GIOChannel, g_fopen, etc. */ if ((fd = open(filename, O_RDONLY)) == -1) { - sr_err("la8input: %s: file open failed", __func__); + sr_err("la8 in: %s: file open failed", __func__); return SR_ERR; } @@ -128,10 +128,10 @@ static int loadfile(struct sr_input *in, const char *filename) close(fd); /* FIXME */ return SR_ERR; } - sr_dbg("la8input: %s: samplerate is %" PRIu64, __func__, samplerate); + sr_dbg("la8 in: %s: samplerate is %" PRIu64, __func__, samplerate); /* Send header packet to the session bus. */ - sr_dbg("la8input: %s: sending SR_DF_HEADER packet", __func__); + sr_dbg("la8 in: %s: sending SR_DF_HEADER packet", __func__); packet.type = SR_DF_HEADER; packet.payload = &header; header.feed_version = 1; @@ -143,7 +143,7 @@ static int loadfile(struct sr_input *in, const char *filename) /* TODO: Handle trigger point. */ /* Send data packets to the session bus. */ - sr_dbg("la8input: %s: sending SR_DF_LOGIC data packets", __func__); + sr_dbg("la8 in: %s: sending SR_DF_LOGIC data packets", __func__); packet.type = SR_DF_LOGIC; packet.payload = &logic; logic.unitsize = (num_probes + 7) / 8; @@ -159,7 +159,7 @@ static int loadfile(struct sr_input *in, const char *filename) close(fd); /* FIXME */ /* Send end packet to the session bus. */ - sr_dbg("la8input: %s: sending SR_DF_END", __func__); + sr_dbg("la8 in: %s: sending SR_DF_END", __func__); packet.type = SR_DF_END; packet.payload = NULL; sr_session_bus(in->vdevice, &packet); diff --git a/output/analog.c b/output/analog.c index 6462c96d..1922e1e6 100644 --- a/output/analog.c +++ b/output/analog.c @@ -284,7 +284,8 @@ static int data_bits(struct sr_output *o, const char *data_in, } } } else { - sr_info("short buffer (length_in=%" PRIu64 ")", length_in); + sr_info("analog out: short buffer (length_in=%" PRIu64 ")", + length_in); } *data_out = outbuf; @@ -442,7 +443,8 @@ static int data_ascii(struct sr_output *o, const char *data_in, ctx->prevsample = sample; } } else { - sr_info("short buffer (length_in=%" PRIu64 ")", length_in); + sr_info("analog out: short buffer (length_in=%" PRIu64 ")", + length_in); } *data_out = outbuf; diff --git a/output/text/ascii.c b/output/text/ascii.c index b8dad68e..1f7064c8 100644 --- a/output/text/ascii.c +++ b/output/text/ascii.c @@ -108,7 +108,8 @@ SR_PRIV int data_ascii(struct sr_output *o, const char *data_in, ctx->prevsample = sample; } } else { - sr_info("short buffer (length_in=%" PRIu64 ")", length_in); + sr_info("ascii out: short buffer (length_in=%" PRIu64 ")", + length_in); } *data_out = outbuf; diff --git a/output/text/bits.c b/output/text/bits.c index ffaf30d6..7e2d665a 100644 --- a/output/text/bits.c +++ b/output/text/bits.c @@ -94,7 +94,8 @@ SR_PRIV int data_bits(struct sr_output *o, const char *data_in, } } } else { - sr_info("short buffer (length_in=%" PRIu64 ")", length_in); + sr_info("bits out: short buffer (length_in=%" PRIu64 ")", + length_in); } *data_out = outbuf; diff --git a/output/vcd.c b/output/vcd.c index 9b598936..698c65ae 100644 --- a/output/vcd.c +++ b/output/vcd.c @@ -64,7 +64,7 @@ static int init(struct sr_output *o) ctx->probelist[ctx->num_enabled_probes++] = probe->name; } if (ctx->num_enabled_probes > 94) { - sr_err("VCD only supports 94 probes."); + sr_err("vcd out: VCD only supports 94 probes."); return SR_ERR; } diff --git a/session.c b/session.c index 39f47ae7..6a6cc923 100644 --- a/session.c +++ b/session.c @@ -413,7 +413,6 @@ static void datafeed_dump(struct sr_datafeed_packet *packet) sr_dbg("bus: received unknown packet type %d", packet->type); break; } - } /** @@ -426,7 +425,7 @@ static void datafeed_dump(struct sr_datafeed_packet *packet) * @return SR_OK upon success, SR_ERR_ARG upon invalid arguments. */ SR_PRIV int sr_session_bus(struct sr_device *device, - struct sr_datafeed_packet *packet) + struct sr_datafeed_packet *packet) { GSList *l; sr_datafeed_callback cb; diff --git a/session_driver.c b/session_driver.c index 946676a4..7d2b9bda 100644 --- a/session_driver.c +++ b/session_driver.c @@ -106,7 +106,8 @@ static int feed_chunk(int fd, int revents, void *session_data) continue; if (!(buf = g_try_malloc(CHUNKSIZE))) { - sr_err("session: %s: buf malloc failed", __func__); + sr_err("session driver: %s: buf malloc failed", + __func__); return FALSE; /* TODO: SR_ERR_MALLOC */ } @@ -179,12 +180,12 @@ static int hw_opendev(int device_index) struct sr_device_instance *sdi; sdi = sr_dev_inst_new(device_index, SR_ST_INITIALIZING, - NULL, NULL, NULL); + NULL, NULL, NULL); if (!sdi) return SR_ERR; if (!(sdi->priv = g_try_malloc0(sizeof(struct session_vdevice)))) { - sr_err("session: %s: sdi->priv malloc failed", __func__); + sr_err("session driver: %s: sdi->priv malloc failed", __func__); return SR_ERR_MALLOC; } @@ -286,21 +287,21 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id) vdevice->capturefile); if (!(vdevice->archive = zip_open(sessionfile, 0, &err))) { - sr_err("Failed to open session file '%s': zip error %d\n", - sessionfile, err); + sr_err("session driver: Failed to open session file '%s': " + "zip error %d\n", sessionfile, err); return SR_ERR; } if (zip_stat(vdevice->archive, vdevice->capturefile, 0, &zs) == -1) { - sr_err("Failed to check capture file '%s' in session file " - "'%s'.", vdevice->capturefile, sessionfile); + sr_err("session driver: Failed to check capture file '%s' in " + "session file '%s'.", vdevice->capturefile, sessionfile); return SR_ERR; } if (!(vdevice->capfile = zip_fopen(vdevice->archive, vdevice->capturefile, 0))) { - sr_err("Failed to open capture file '%s' in session file '%s'.", - vdevice->capturefile, sessionfile); + sr_err("session driver: Failed to open capture file '%s' in " + "session file '%s'.", vdevice->capturefile, sessionfile); return SR_ERR; } @@ -308,12 +309,12 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id) sr_session_source_add(-1, 0, 0, feed_chunk, session_device_id); if (!(packet = g_try_malloc(sizeof(struct sr_datafeed_packet)))) { - sr_err("session: %s: packet malloc failed", __func__); + sr_err("session driver: %s: packet malloc failed", __func__); return SR_ERR_MALLOC; } if (!(header = g_try_malloc(sizeof(struct sr_datafeed_header)))) { - sr_err("session: %s: header malloc failed", __func__); + sr_err("session driver: %s: header malloc failed", __func__); return SR_ERR_MALLOC; } diff --git a/session_file.c b/session_file.c index d983d7a0..c40e54fa 100644 --- a/session_file.c +++ b/session_file.c @@ -60,25 +60,26 @@ SR_API int sr_session_load(const char *filename) } if (!(archive = zip_open(filename, 0, &err))) { - sr_dbg("Failed to open session file: zip error %d", err); + sr_dbg("session file: Failed to open session file: zip " + "error %d", err); return SR_ERR; } /* check "version" */ if (!(zf = zip_fopen(archive, "version", 0))) { - sr_dbg("Not a sigrok session file."); + sr_dbg("session file: Not a sigrok session file."); return SR_ERR; } ret = zip_fread(zf, &c, 1); if (ret != 1 || c != '1') { - sr_dbg("Not a valid sigrok session file."); + sr_dbg("session file: Not a valid sigrok session file."); return SR_ERR; } zip_fclose(zf); /* read "metadata" */ if (zip_stat(archive, "metadata", 0, &zs) == -1) { - sr_dbg("Not a valid sigrok session file."); + sr_dbg("session file: Not a valid sigrok session file."); return SR_ERR; } @@ -93,7 +94,7 @@ SR_API int sr_session_load(const char *filename) kf = g_key_file_new(); if (!g_key_file_load_from_data(kf, metafile, zs.size, 0, NULL)) { - sr_dbg("Failed to parse metadata."); + sr_dbg("session file: Failed to parse metadata."); return SR_ERR; } @@ -195,7 +196,7 @@ int sr_session_save(const char *filename) if (!(versrc = zip_source_buffer(zipfile, version, 1, 0))) return SR_ERR; if (zip_add(zipfile, "version", versrc) == -1) { - sr_info("error saving version into zipfile: %s", + sr_info("session file: error saving version into zipfile: %s", zip_strerror(zipfile)); return SR_ERR; } @@ -276,7 +277,8 @@ int sr_session_save(const char *filename) return SR_ERR; if ((ret = zip_close(zipfile)) == -1) { - sr_info("error saving zipfile: %s", zip_strerror(zipfile)); + sr_info("session file: error saving zipfile: %s", + zip_strerror(zipfile)); return SR_ERR; }