void connectionWaiting() { int new_conns; int max_field; FD_ZERO(&readfds); //set up the list FD_SET(sockfd, &readfds); //listen for new connections max_field = setDescriptors(); new_conns = select(max_field + 1/*+1 is defined max size plus one see man*/, &readfds, (fd_set *) 0, (fd_set *) 0, &timeout); //now we wait for timeout length if (new_conns < 0) { error("ERROR on connections"); exit(EXIT_FAILURE); } if (new_conns == 0) { //nothing new //printf("."); fflush(stdout); } else readSocks(); }
void USB::init() { iprintf("init\n"); uint32_t chip_serial[4]; getSerialNumber(4, chip_serial); for (int j = 0; j < 4; j++) { for (int i = 0; i < 8; i++) { uint8_t c = (chip_serial[j] & 15); serial.str[j * 8 + 7 - i] = (c < 10)?(c + '0'):(c - 10 + 'A'); chip_serial[j] >>= 4; } } setDescriptors(descriptors); USBHAL::init(); iprintf("OK\n"); }