Changeset cbe03fd8 in subsurface


Ignore:
Timestamp:
May 29, 2017, 9:55:49 PM (6 months ago)
Author:
Dirk Hohndel <dirk@…>
Branches:
master
Children:
f6f74a0
Parents:
c05fe9f
git-author:
Dirk Hohndel <dirk@…> (05/29/17 20:56:42)
git-committer:
Dirk Hohndel <dirk@…> (05/29/17 21:55:49)
Message:

FTDI support: add minimal debugging output

Copied the libdivecomputer macros for convenience.

Signed-off-by: Dirk Hohndel <dirk@…>

Location:
core
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • core/libdivecomputer.c

    r76a38b6 rcbe03fd8  
    3838static bool in_deco, first_temp_is_air;
    3939static int current_gas_index;
     40
     41/* logging bits from libdivecomputer */
     42#ifndef __ANDROID__
     43#define INFO(context, fmt, ...) fprintf(stderr, "INFO: " fmt "\n", ##__VA_ARGS__)
     44#define ERROR(context, fmt, ...)        fprintf(stderr, "ERROR: " fmt "\n", ##__VA_ARGS__)
     45#else
     46#include <android/log.h>
     47#define INFO(context, fmt, ...) __android_log_print(ANDROID_LOG_DEBUG, __FILE__, "INFO: " fmt "\n", ##__VA_ARGS__)
     48#define ERROR(context, fmt, ...)        __android_log_print(ANDROID_LOG_DEBUG, __FILE__, "ERROR: " fmt "\n", ##__VA_ARGS__)
     49#endif
    4050
    4151/*
     
    10771087        } else if (!strcmp(data->devname, "ftdi")) {
    10781088                rc = dc_context_set_custom_serial(data->context, &serial_ftdi_ops);
     1089                INFO(0, "setting up ftdi ops");
     1090#else
     1091                INFO(0, "FTDI disabled");
    10791092#endif
    10801093        }
     
    10871100#endif
    10881101                rc = dc_device_open(&data->device, data->context, data->descriptor, data->devname);
    1089 
     1102                INFO(0, "dc_deveice_open error value of %d", rc);
    10901103                if (rc != DC_STATUS_SUCCESS && subsurface_access(data->devname, R_OK | W_OK) != 0)
    10911104                        err = translate("gettextFromC", "Insufficient privileges to open the device %s %s (%s)");
  • core/serial_ftdi.c

    rb368ecd rcbe03fd8  
    122122static int serial_ftdi_open_device (struct ftdi_context *ftdi_ctx)
    123123{
     124        INFO(0, "serial_ftdi_open_device called");
    124125        int accepted_pids[] = { 0x6001, 0x6010, 0x6011, // Suunto (Smart Interface), Heinrichs Weikamp
    125126                0xF460, // Oceanic
     
    132133                pid = accepted_pids[i];
    133134                ret = ftdi_usb_open (ftdi_ctx, VID, pid);
     135                INFO(0, "FTDI tried VID %04x pid %04x ret %d\n", VID, pid, ret);
    134136                if (ret == -3) // Device not found
    135137                        continue;
     
    146148static dc_status_t serial_ftdi_open (void **userdata, const char* name)
    147149{
     150        INFO(0, "serial_ftdi_open called");
    148151        // Allocate memory.
    149152        ftdi_serial_t *device = (ftdi_serial_t *) malloc (sizeof (ftdi_serial_t));
     
    152155                return DC_STATUS_NOMEMORY;
    153156        }
    154 
     157        INFO(0, "setting up ftdi_ctx");
    155158        struct ftdi_context *ftdi_ctx = ftdi_new();
    156159        if (ftdi_ctx == NULL) {
     
    172175
    173176        // Initialize device ftdi context
     177        INFO(0, "initialize ftdi_ctx");
    174178        ftdi_init(ftdi_ctx);
    175179
Note: See TracChangeset for help on using the changeset viewer.