static int uirt2_send(struct ir_remote *remote, struct ir_ncode *code) { int i, length; unsigned long delay; const lirc_t *signals; int res = 0; if (!init_send(remote, code)) { return 0; } length = send_buffer_length(); signals = send_buffer_data(); if (length <= 0 || signals == NULL) { LOGPRINTF(1, "nothing to send"); return 0; } LOGPRINTF(1, "Trying REMSTRUC1 transmission"); res = uirt2_send_mode2_struct1(dev, remote, signals, length); if (!res && (length < 48)) { LOGPRINTF(1, "Using RAW transission"); res = uirt2_send_mode2_raw(dev, remote, signals, length); } if (!res) { logprintf(LIRC_ERROR, "uirt2_send: remote not supported"); } else { LOGPRINTF(1, "uirt2_send: succeeded"); } /* * Some devices send the sequence in the background. Wait for * the sequence to complete before returning in order to avoid * disturbing DTR which is used by certain hardware revisions * to enable the builtin emitter. We wait 1.1 times the expected * time in order to handle any differences between the device and * our clock. */ delay = remote->min_remaining_gap; for (i = 0; i < length; i++) { delay += signals[i]; } delay = (delay * 11) / 10; usleep (delay); return res; }
static int uirt2_send(struct ir_remote *remote,struct ir_ncode *code) { int length; lirc_t *signals; int res = 0; if(!init_send(remote,code)) { return 0; } length = send_buffer.wptr; signals = send_buffer.data; if (length <= 0 || signals == NULL) { LOGPRINTF(1,"nothing to send"); return 0; } LOGPRINTF(1, "Trying REMSTRUC1 transmission"); res = uirt2_send_mode2_struct1(dev, remote, signals, length); if (!res && (length < 48)) { LOGPRINTF(1, "Using RAW transission"); res = uirt2_send_mode2_raw(dev, remote, signals, length); } if (!res) { logprintf(LOG_ERR, "uirt2_send: remote not supported"); } else { LOGPRINTF(1, "uirt2_send: succeeded"); } return res; }