void set_socket_receive_buffer(int sock, int len) { socklen_t sl; if (len <= 0) return; if (setsockopt(sock, SOL_SOCKET, SO_RCVBUFFORCE, &len, sizeof(len))) LOGL(3, "unable to set output UDP buffer (force) size to %d", len); if (setsockopt(sock, SOL_SOCKET, SO_RCVBUF, &len, sizeof(len))) LOGL(3, "unable to set output UDP buffer size to %d", len); sl = sizeof(int); if (!getsockopt(sock, SOL_SOCKET, SO_RCVBUF, &len, &sl)) LOG("output UDP buffer size is %d bytes", len); }
int udp_bind(char *addr, int port) { struct sockaddr_in serv; int sock, optval = 1; if (!fill_sockaddr(&serv, addr, port)) return -1; sock = socket(AF_INET, SOCK_DGRAM, 0); if (sock < 0) { LOGL(0, "udp_bind failed: socket(): %s", strerror(errno)); return -1; } if (addr && atoi(addr) >= 239) { struct ip_mreq mreq; mreq.imr_multiaddr.s_addr = inet_addr(addr); mreq.imr_interface.s_addr = htonl(INADDR_ANY); LOG("setting multicast for %s", addr); if (setsockopt(sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq, sizeof(mreq)) == -1) { LOGL(0, "membership error: %s", strerror(errno)); } } if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval)) < 0) { LOGL(0, "udp_bind failed: setsockopt(SO_REUSEADDR): %s", strerror(errno)); return -1; } if (bind(sock, (struct sockaddr *) &serv, sizeof(serv)) < 0) { LOGL(0, "udp_bind: failed: bind() on host %s port %d: error %s", addr, port, strerror(errno)); return -1; } set_linux_socket_timeout(sock); LOGL(1, "New UDP socket %d bound to %s:%d", sock, inet_ntoa(serv.sin_addr), ntohs(serv.sin_port)); return sock; }
void ConvertYTD(char *filepath) { LOGL("Converting ytd: %s", filepath); char txdName[MAX_PATH]; _splitpath(filepath, NULL, NULL, txdName, NULL); char txdpath[MAX_PATH]; strcpy(txdpath, filepath); if(settings.m_bHashedFileNames) sprintf(&strrchr(txdpath, '\\')[1], "%X.txd", HASH(txdName)); else { strcpy(&txdpath[strlen(txdpath) - 3], "txd"); if(strlen(txdName) > 20) LOGL(" WARNING: File \"%s\" has too long name. Rename this file manually or use \"bHashedFileNames\" option", txdName); }; texture_converter::convert_ytd_to_txd(filepath, txdpath); }
/** * rmnet_init() - Module initialization * * todo: check for (and init) startup errors */ static int __init rmnet_init(void) { rmnet_config_init(); rmnet_vnd_init(); LOGL("%s", "RMNET Data driver loaded successfully"); return 0; }
int tcp_connect(char *addr, int port, struct sockaddr_in *serv, int blocking) { struct sockaddr_in sv; int sock, optval = 1; if (serv == NULL) serv = &sv; if (!fill_sockaddr(serv, addr, port)) return -1; sock = socket(AF_INET, SOCK_STREAM, 0); if (sock < 0) { LOGL(0, "tcp_connect failed: socket() %s", strerror(errno)); return -1; } if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval)) < 0) { LOGL(0, "tcp_connect: setsockopt(SO_REUSEADDR): %s", strerror(errno)); close(sock); return -1; } set_linux_socket_timeout(sock); if (blocking) { int flags = fcntl(sock, F_GETFL, 0); fcntl(sock, F_SETFL, flags | O_NONBLOCK); } if (connect(sock, (struct sockaddr *) serv, sizeof(*serv)) < 0) { if (errno != EINPROGRESS) { LOGL(0, "tcp_connect: failed: connect to %s:%d failed: %s", addr, port, strerror(errno)); close(sock); return -1; } } LOG("New TCP socket %d connected to %s:%d", sock, addr, port); return sock; }
void ConvertYDR(char *filepath) { LOGL("Converting ydr: %s", filepath); char modelName[MAX_PATH]; _splitpath(filepath, NULL, NULL, modelName, NULL); char dffpath[MAX_PATH]; strcpy(dffpath, filepath); //model_converter::convert_ydr_to_dff(filepath, dffpath, modelName); model_converter::convert_ydr_to_obj(filepath, dffpath, modelName); }
int send_diseqc(int fd, int pos, int pol, int hiband, int committed_no, int uncommitted_no) { int uncommitted_first = 0; /* DiSEqC 1.0 */ struct dvb_diseqc_master_cmd cmd = { { 0xe0, 0x10, 0x38, 0xf0, 0x00, 0x00 }, 4 }; /* DiSEqC 1.1 */ struct dvb_diseqc_master_cmd uncmd = { { 0xe0, 0x10, 0x39, 0xf0, 0x00, 0x00 }, 4 }; cmd.msg[3] = 0xf0 | (((pos << 2) & 0x0c) | (hiband ? 1 : 0) | (pol ? 2 : 0)); uncmd.msg[3] = 0xf0 | (pos & 0x0f); if (uncommitted_no > committed_no) uncommitted_first = 1; if (committed_no == 0 && uncommitted_no == 0) committed_no = 1; LOGL(3, "send_diseqc fd %d, pos = %d, pol = %d, hiband = %d, diseqc => %02x %02x %02x %02x %02x", fd, pos, pol, hiband, cmd.msg[0], cmd.msg[1], cmd.msg[2], cmd.msg[3], cmd.msg[4]); if (ioctl(fd, FE_SET_TONE, SEC_TONE_OFF) == -1) LOG("send_diseqc: FE_SET_TONE failed for fd %d: %s", fd, strerror(errno)); if (ioctl(fd, FE_SET_VOLTAGE, pol ? SEC_VOLTAGE_18 : SEC_VOLTAGE_13) == -1) LOG("send_diseqc: FE_SET_VOLTAGE failed for fd %d: %s", fd, strerror(errno)); if (uncommitted_first) diseqc_cmd(fd, uncommitted_no, "uncommitted", &uncmd); diseqc_cmd(fd, committed_no, "committed", &cmd); if (!uncommitted_first) diseqc_cmd(fd, uncommitted_no, "uncommitted", &uncmd); usleep(15000); if (ioctl(fd, FE_DISEQC_SEND_BURST, (pos & 1) ? SEC_MINI_B : SEC_MINI_A) == -1) LOG("send_diseqc: FE_DISEQC_SEND_BURST failed for fd %d: %s", fd, strerror(errno)); usleep(15000); if (ioctl(fd, FE_SET_TONE, hiband ? SEC_TONE_ON : SEC_TONE_OFF) == -1) LOG("send_diseqc: FE_SET_TONE failed for fd %d: %s", fd, strerror(errno)); return 0; }
void FailedLoginDialog::accept() { LOGL(4, "FailedLoginDialog::accept()"); if (!ui.proxyFrame->isHidden()) { LastFmSettings& s = The::settings(); s.setProxyHost( ui.proxyHostEdit->text() ); s.setProxyPort( ui.proxyPortEdit->text().toInt() ); s.setProxyUser( ui.proxyUsernameEdit->text() ); s.setProxyPassword( ui.proxyPasswordEdit->text() ); s.setUseProxy( !s.getProxyHost().isEmpty() ); } LOGL(4, "FailedLoginDialog calling QDialog::accept()"); QDialog::accept(); }
void RtAudioPlayback::initAudio( long sampleRate, int channels ) { //int channels = 2; //int sampleRate = 44100; int nBuffers = 16; int bufferSize = 512; try { RtAudio::RtAudioApi api = RtAudio::UNSPECIFIED; RtAudioFormat format = RTAUDIO_SINT16; m_audio = new RtAudio(); int card = internalSoundCardID( m_deviceNum ); #ifdef Q_WS_X11 api = RtAudio::LINUX_ALSA; #endif RtAudioDeviceInfo info = m_audio->getDeviceInfo( card ); delete m_audio; if ( info.nativeFormats & RTAUDIO_SINT32 ) { format = RTAUDIO_SINT32; } if ( info.nativeFormats & RTAUDIO_SINT24 ) { format = RTAUDIO_SINT24; } if ( info.nativeFormats & RTAUDIO_SINT16 ) { format = RTAUDIO_SINT16; } m_audio = new RtAudio( card, channels, 0, 0, format, sampleRate, &bufferSize, nBuffers, api ); } catch ( RtError &error ) { LOGL( 1, "Initialising RtAudio failed. RtAudio error type: " << error.getType() << " Message: " << error.getMessage() ); // Don't delete m_audio here or it will crash. // We don't emit an error signal here, it happens on startPlayback if // we have no m_audio. m_audio = 0; return; } }
void ITunesScript::transmit( const QString& data ) { // thread-safe, basically int const port = m_listener->GetPort(); LOGL( 3, "ITunesScript data being sent " << data << " to port " << port ); QTcpSocket socket; socket.connectToHost( QHostAddress::LocalHost, port ); if ( socket.waitForConnected( 1000 ) ) //FIXME hangs GUI thread? { int bytesWritten = socket.write( data.toUtf8() ); socket.flush(); socket.waitForDisconnected( 1000 ); //FIXME hangs? if ( bytesWritten == -1 ) { LOGL( 1, "Sending submission through socket failed." ) } }
static struct izo_upcall_hdr *upc_pack(__u32 opcode, int pathlen, char *path, char *fsetname, int reclen, char *rec, int *size) { struct izo_upcall_hdr *hdr; char *ptr; ENTRY; *size = sizeof(struct izo_upcall_hdr); if ( fsetname ) { *size += round_strlen(fsetname); } if ( path ) { *size += round_strlen(path); } if ( rec ) { *size += size_round(reclen); } PRESTO_ALLOC(hdr, *size); if (!hdr) { CERROR("intermezzo upcall: out of memory (opc %d)\n", opcode); EXIT; return NULL; } memset(hdr, 0, *size); ptr = (char *)hdr + sizeof(*hdr); /* XXX do we need fsuid ? */ hdr->u_len = *size; hdr->u_version = IZO_UPC_VERSION; hdr->u_opc = opcode; hdr->u_pid = current->pid; hdr->u_uid = current->fsuid; if (path) { /*XXX Robert: please review what len to pass in for NUL terminated strings */ hdr->u_pathlen = strlen(path); LOGL0(path, hdr->u_pathlen, ptr); } if (fsetname) { hdr->u_fsetlen = strlen(fsetname); LOGL0(fsetname, strlen(fsetname), ptr); } if (rec) { hdr->u_reclen = reclen; LOGL(rec, reclen, ptr); } EXIT; return hdr; }
void ConvertYFT(char *filepath) { LOGL("Converting yft: %s", filepath); char modelName[MAX_PATH]; _splitpath(filepath, NULL, NULL, modelName, NULL); char dffpath[MAX_PATH]; strcpy(dffpath, filepath); if(settings.m_bHashedFileNames) { sprintf(modelName, "%X", HASH(modelName)); sprintf(&strrchr(dffpath, '\\')[1], "%s.dff", modelName); } else { strcpy(&dffpath[strlen(dffpath) - 3], "dff"); if(!settings.m_bHashedFileNames && strlen(modelName) > 20) LOGL(" WARNING: File \"%s\" has too long name. Rename this file manually or use \"bHashedFileNames\" option", modelName); modelName[23] = '\0'; } model_converter::convert_yft_to_dff(filepath, dffpath, modelName); }
WebService::WebService( QObject* parent ) : QObject( parent ), m_isAutoDetectedProxy( false ), m_proxyPort( 0 ), m_isSubscriber( false ) { LOGL( 3, "Initialising Web Service" ); //TODO needs to be a setting, to manually set the proxy or automatically if( !SharedSettings::instance()->isUseProxy() ) autoDetectProxy(); }
/** * rmnet_unset_logical_endpoint_config() - Un-set logical endpoing configuration * on a device * @dev: Device to set endpoint configuration on * @config_id: logical endpoint id on device * * Retrieves the logical_endpoint_config structure and frees the egress device. * Network device must already have association with RmNet Data driver * * Return: * - RMNET_CONFIG_OK if successful * - RMNET_CONFIG_UNKNOWN_ERROR net_device private section is null * - RMNET_CONFIG_NO_SUCH_DEVICE device is not associated * - RMNET_CONFIG_BAD_ARGUMENTS if logical endpoint id is out of range */ int rmnet_unset_logical_endpoint_config(struct net_device *dev, int config_id) { LOGL("(%s, %d);", dev->name, config_id); if (!dev || ((!_rmnet_is_physical_endpoint_associated(dev)) && (!rmnet_vnd_is_vnd(dev)))) { return RMNET_CONFIG_NO_SUCH_DEVICE; } return _rmnet_unset_logical_endpoint_config(dev, config_id); }
void print_trace(void) { void *array[10]; size_t size; char **strings; size_t i; #ifndef __mips__ size = backtrace(array, 10); LOGL(0, "Obtained %zd stack frames.\n", size); for (i = 0; i < size; i++) { LOGL(0, "%p : ", array[i]); if (addr2line(pn, array[i])) LOGL(0, "\n"); } #else LOGL(0, " No backtrace defined\n"); #endif }
int setup_switch(int frontend_fd, transponder *tp) { int hiband = 0; int diseqc = (tp->diseqc > 0) ? tp->diseqc - 1 : 0; int freq = tp->freq; int pol = (tp->pol - 1) & 1; if (tp->pol > 2) { freq = (freq - LOF3); hiband = 0; } else if (freq < SLOF) { freq = (freq - LOF1); hiband = 0; } else { freq = (freq - LOF2); hiband = 1; } if (tp->switch_type == SWITCH_UNICABLE) { freq = send_unicable(frontend_fd, freq / 1000, diseqc, pol, hiband, tp->uslot, tp->ufreq, tp->pin); } else if (tp->switch_type == SWITCH_JESS) { freq = send_jess(frontend_fd, freq / 1000, diseqc, pol, hiband, tp->uslot, tp->ufreq, tp->pin); } else { if (tp->old_pol != pol || tp->old_hiband != hiband || tp->old_diseqc != diseqc) send_diseqc(frontend_fd, diseqc, pol, hiband, tp->committed_no, tp->uncommitted_no); else LOGL(3, "Skip sending diseqc commands since the switch position doesn't need to be changed: pol %d, hiband %d, switch position %d", pol, hiband, diseqc); } tp->old_pol = pol; tp->old_hiband = hiband; tp->old_diseqc = diseqc; return freq; }
void URLLabel::openURL( const QUrl& url ) { if ( !url.isEmpty() ) { LOGL( 3, "Opening in browser: " << url ); #ifndef Q_WS_WIN QDesktopServices::openUrl( QUrl::fromEncoded( url.toString().toUtf8() ) ); #else QDesktopServices::openUrl( url ); #endif } }
int netcv_tune(int aid, transponder * tp) { //fprintf(stderr, "REEL: netcv_tune (id=%d, tp.freq=%d)\n", aid, tp->freq); adapter *ad = get_adapter(aid); if (!ad) return 1; if (tp->sys == SYS_DVBT) LOGL(0, "netceiver: Sorry, DVB-T not yet implemented"); SN.want_tune = 1; // we do not tune right now, just set the flag for netcv_commit SN.want_commit = 0; SN.lp = 0; // make sure number of active pids is 0 after tuning return 0; }
int netcv_set_pid(adapter *ad, uint16_t pid) { //fprintf(stderr, "REEL: netcv_set_pid (id=%d, pid=%d)\n", ad->id, pid); int aid = ad->id; LOGL(3, "netceiver: set_pid for adapter %d, pid %d, err %d", aid, pid, SN.err); if (SN.err) // error reported, return error return 0; SN.npid[SN.lp] = pid; SN.lp++; SN.want_commit = 1; return aid + 100; }
int send_unicable(int fd, int freq, int pos, int pol, int hiband, int slot, int ufreq, int pin) { struct dvb_diseqc_master_cmd cmd = { { 0xe0, 0x11, 0x5a, 0x00, 0x00 }, 5 }; int t; t = (freq + ufreq + 2) / 4 - 350; cmd.msg[3] = ((t & 0x0300) >> 8) | (slot << 5) | (pos ? 0x10 : 0) | (hiband ? 4 : 0) | (pol ? 8 : 0); cmd.msg[4] = t & 0xff; if (pin) { cmd.msg_len = 6; cmd.msg[2] = 0x5C; cmd.msg[5] = pin; } LOGL(3, "send_unicable fd %d, freq %d, ufreq %d, pos = %d, pol = %d, hiband = %d, slot %d, diseqc => %02x %02x %02x %02x %02x", fd, freq, ufreq, pos, pol, hiband, slot, cmd.msg[0], cmd.msg[1], cmd.msg[2], cmd.msg[3], cmd.msg[4]); if (ioctl(fd, FE_SET_VOLTAGE, SEC_VOLTAGE_13) == -1) LOG("send_unicable: pre voltage SEC_VOLTAGE_13 failed for fd %d: %s", fd, strerror(errno)); usleep(15000); if (ioctl(fd, FE_SET_TONE, SEC_TONE_OFF) == -1) LOG("send_unicable: FE_SET_TONE failed for fd %d: %s", fd, strerror(errno)); if (ioctl(fd, FE_SET_VOLTAGE, SEC_VOLTAGE_18) == -1) LOG("send_unicable: FE_SET_VOLTAGE failed for fd %d: %s", fd, strerror(errno)); usleep(15000); if (ioctl(fd, FE_DISEQC_SEND_MASTER_CMD, &cmd) == -1) LOG("send_unicable: FE_DISEQC_SEND_MASTER_CMD failed for fd %d: %s", fd, strerror(errno)); usleep(15000); if (ioctl(fd, FE_SET_VOLTAGE, SEC_VOLTAGE_13) == -1) LOG("send_unicable: FE_SET_VOLTAGE failed for fd %d: %s", fd, strerror(errno)); return ufreq * 1000; }
int send_jess(int fd, int freq, int pos, int pol, int hiband, int slot, int ufreq, int pin) { struct dvb_diseqc_master_cmd cmd = { { 0x70, 0x00, 0x00, 0x00, 0x00 }, 4 }; // int t = (freq / 1000) - 100; int t = freq - 100; cmd.msg[1] = slot << 3; cmd.msg[1] |= ((t << 8) & 0x07); cmd.msg[2] = (t & 0xff); cmd.msg[3] = ((pos & 0x3f) << 2) | (pol ? 2 : 0) | (hiband ? 1 : 0); if (pin < 256) { cmd.msg_len = 5; cmd.msg[0] = 0x71; cmd.msg[4] = pin; } LOGL(3, "send_jess fd %d, freq %d, ufreq %d, pos = %d, pol = %d, hiband = %d, slot %d, diseqc => %02x %02x %02x %02x %02x", fd, freq, ufreq, pos, pol, hiband, slot, cmd.msg[0], cmd.msg[1], cmd.msg[2], cmd.msg[3], cmd.msg[4]); if (ioctl(fd, FE_SET_VOLTAGE, SEC_VOLTAGE_13) == -1) LOG("send_jess: pre voltage SEC_VOLTAGE_13 failed for fd %d: %s", fd, strerror(errno)); usleep(15000); if (ioctl(fd, FE_SET_TONE, SEC_TONE_OFF) == -1) LOG("send_jess: FE_SET_TONE failed for fd %d: %s", fd, strerror(errno)); if (ioctl(fd, FE_SET_VOLTAGE, SEC_VOLTAGE_18) == -1) LOG("send_jess: FE_SET_VOLTAGE failed for fd %d: %s", fd, strerror(errno)); usleep(15000); if (ioctl(fd, FE_DISEQC_SEND_MASTER_CMD, &cmd) == -1) LOG("send_jess: FE_DISEQC_SEND_MASTER_CMD failed for fd %d: %s", fd, strerror(errno)); usleep(15000); if (ioctl(fd, FE_SET_VOLTAGE, SEC_VOLTAGE_13) == -1) LOG("send_jess: FE_SET_VOLTAGE failed for fd %d: %s", fd, strerror(errno)); return ufreq * 1000; }
int udp_bind_connect(char *src, int sport, char *dest, int dport, struct sockaddr_in *serv) { int sock; sock = udp_bind(src, sport); if (sock < 0) return sock; fill_sockaddr(serv, dest, dport); if (connect(sock, (struct sockaddr *) serv, sizeof(*serv)) < 0) { LOGL(0, "udp_bind_connect: failed: bind(): %s", strerror(errno)); return -1; } LOG("New UDP socket %d connected to %s:%d", sock, inet_ntoa(serv->sin_addr), ntohs(serv->sin_port)); return sock; }
STmpinfo *getFreeItemPos(int64_t key) { int i; int tick = getTick(); for (i = 0; i < MAX_SINFO; i++) if (!sinfo[i].enabled || (sinfo[i].timeout && (tick - sinfo[i].last_updated > sinfo[i].timeout))) { sinfo[i].id = i; sinfo[i].timeout = 0; sinfo[i].no_change = 0; sinfo[i].prev_no_change = 0; LOGL(2, "Requested new Item for key %llX, returning %d", key, i); return sinfo + i; } return NULL; }
/** * rmnet_associate_network_device() - Associate network device * @dev: Device to register with RmNet data * * Typically used on physical network devices. Registers RX handler and private * metadata structures. * * Return: * - RMNET_CONFIG_OK if successful * - RMNET_CONFIG_NO_SUCH_DEVICE dev is null * - RMNET_CONFIG_INVALID_REQUEST if the device to be associated is a vnd * - RMNET_CONFIG_DEVICE_IN_USE if dev rx_handler is already filled * - RMNET_CONFIG_DEVICE_IN_USE if netdev_rx_handler_register() fails */ int rmnet_associate_network_device(struct net_device *dev) { struct rmnet_phys_ep_conf_s *config; int rc; ASSERT_RTNL(); LOGL("(%s);\n", dev->name); if (!dev) return RMNET_CONFIG_NO_SUCH_DEVICE; if (_rmnet_is_physical_endpoint_associated(dev)) { LOGM("%s is already regestered", dev->name); return RMNET_CONFIG_DEVICE_IN_USE; } if (rmnet_vnd_is_vnd(dev)) { LOGM("%s is a vnd", dev->name); return RMNET_CONFIG_INVALID_REQUEST; } config = (struct rmnet_phys_ep_conf_s *) kmalloc(sizeof(struct rmnet_phys_ep_conf_s), GFP_ATOMIC); if (!config) return RMNET_CONFIG_NOMEM; memset(config, 0, sizeof(struct rmnet_phys_ep_conf_s)); config->dev = dev; spin_lock_init(&config->agg_lock); rc = netdev_rx_handler_register(dev, rmnet_rx_handler, config); if (rc) { LOGM("netdev_rx_handler_register returns %d", rc); kfree(config); return RMNET_CONFIG_DEVICE_IN_USE; } /* Explicitly hold a reference to the device */ dev_hold(dev); trace_rmnet_associate(dev); return RMNET_CONFIG_OK; }
void HttpInput::data( QByteArray& fillMe, int numBytes ) { switch ( m_state ) { case State_FetchingStream: case State_Buffering: { // Do nothing, the caller will have to wait until we're streaming again. Q_ASSERT( !"Caller shouldn't call us when we're not streaming." ); } break; case State_Streaming: case State_Stopped: { // Even though we've stopped there might still be data left in the buffer fillMe = m_buffer.left( numBytes ); m_buffer.remove( 0, numBytes ); // Once the Http connection's closed, we've gone to Stopped if ( m_state != State_Stopped ) { if ( m_buffer.size() == 0 ) { LOGL( 3, "Buffer empty, buffering..." ); m_timeoutTimer.start(); setState( State_Buffering ); emit buffering( 0, m_bufferCapacity ); } } } break; default: { Q_ASSERT( !"Unhandled state" ); } break; } }
int satipc_rtcp_reply(sockets * s) { unsigned char *b = s->buf, *ver, *signal; char *tun; int i, rlen = s->rlen; adapter *ad = get_adapter(s->sid); int strength, status, snr; uint32_t rp; if (!ad) return 0; // LOG("satip_rtcp_reply called"); if (b[0] == 0x80 && b[1] == 0xC8) { copy32r(rp, b, 20); if ((++ad->repno % 100) == 0) //every 20s LOG( "satipc: rtp report, adapter %d: rtcp missing packets %d, rtp missing %d, rtp ooo %d, pid err %d", ad->id, rp - ad->rcvp, ad->rtp_miss, ad->rtp_ooo, ad->pid_err - ad->dec_err); } for (i = 0; i < rlen - 4; i++) if (b[i] == 'v' && b[i + 1] == 'e' && b[i + 2] == 'r' && b[i + 3] == '=') { ver = b + i; tun = strstr((const char*) ver, "tuner="); if (tun) signal = strchr(tun, ','); if (signal) { sscanf(signal + 1, "%d,%d,%d", &strength, &status, &snr); if (ad->strength != strength && ad->snr != snr) LOGL(3, "satipc: Received signal status from the server for adapter %d, stength=%d status=%d snr=%d", ad->id, strength, status, snr); ad->strength = strength; ad->status = status ? FE_HAS_LOCK : 0; ad->snr = snr; } } return 0; }
void posix_signal_handler(int sig, siginfo_t * siginfo, ucontext_t * ctx) { int sp = 0, ip = 0; if (sig == SIGINT) { run_loop = 0; return; } #ifdef __mips__ sp = ctx->uc_mcontext.gregs[29]; ip = ctx->uc_mcontext.pc; #endif LOGL(0, "RECEIVED SIGNAL %d - SP=%lX IP=%lX\n", sig, (long unsigned int ) sp, (long unsigned int ) ip); print_trace(); exit(1); }
void PlayCountsDatabase::beginTransaction() { // we try until blue in the face to begin the transaction, as we really, // really want db lock QSqlQuery q( m_db ); q.exec( "BEGIN TRANSACTION" ); for (int i = 5; q.lastError().type() == QSqlError::ConnectionError && i; i--) { // we only try 5 times since SQLITE_BUSY is just one of the // possible things that ConnectionError might mean LOGL( 3, "SQLite might be busy trying again in 25ms..." ); UnicornUtils::msleep( 25 ); q.exec(); } }
void HttpInput::onHttpRequestFinished( int id, bool err ) { Q_UNUSED( id ); m_timeoutTimer.stop(); if ( err ) { // QHttp error codes: //NoError, //UnknownError, //HostNotFound, //ConnectionRefused, //UnexpectedClose, //InvalidResponseHeader, //WrongContentLength, //Aborted if ( m_http.error() != QHttp::Aborted ) { LOGL( 2, "HttpInput get failed. " << "\n" << " Http response: " << m_http.lastResponse().statusCode() << "\n" << " QHttp error code: " << m_http.error() << "\n" << " QHttp error text: " << m_http.errorString() << "\n" << " Request: " << m_http.currentRequest().path() << "\n" << " Bytes returned: " << m_http.bytesAvailable() << "\n" ); // Streamer not contactable emit error( Radio_ConnectionRefused, m_genericAsOfYetUndiagnosedStreamerError + "\n\nHttp error: " + m_http.errorString() ); } } // If we do this here instead of in onHttpStateChanged, it works both for // proxied and non-proxied connections. For some reason, a proxy connection // emits a different sequence of state changes so listening out for Closing // wasn't reliable. if ( id == m_lastRequestId ) { setState( State_Stopped ); } }
void HttpInput::setState( RadioState newState ) { // These are the only valid states Q_ASSERT( newState == State_FetchingStream || newState == State_StreamFetched || newState == State_Buffering || newState == State_Streaming || newState == State_Stopped ); if ( newState != m_state ) { LOGL( 4, "HttpInput state: " << radioState2String( newState ) ); m_state = newState; emit stateChanged( newState ); } }