Ejemplo n.º 1
0
void getDevices( std::vector<pollfd> &deviceFds )
{
   DIR * dir;
   struct dirent *result;
   char *devPathName;
   int devNum;
   if ( NULL != (dir = opendir( inputPath )) )
   {
      while( NULL != (result = readdir( dir )) )
      {
         int len= strlen( result->d_name );
         if ( (len >= 5) && !strncmp(result->d_name, "event", 5) )
         {
            if ( sscanf( result->d_name, "event%d", &devNum ) == 1 )
            {
               printf(" [%s] ", result->d_name);
               devPathName= getDevice( inputPath, result->d_name );

               if ( devPathName )
               {
                  openDevice( deviceFds, devPathName );
                  free( devPathName );
               }
            }
         }
      }

      closedir( dir );
   }
}
Ejemplo n.º 2
0
int main(int argc, char *argv[]){
  pthread_t monitor;
  int file;
  if(argc != 2){
    printf("Usage is: lidar <device file>\n");
    goto error;
  }
  file = openDevice(argv[1]);

  if(file < 0){
    printf("error opening file\n");
    goto error;
  }

  signal(SIGUSR1, danger);
  signal(SIGINT, quit);
  keepChecking = 1;
  pthread_create(&monitor, NULL, (void*) &monitorDistance, (void*) &file);

  pthread_join(monitor, NULL);
  close(file);

error:
  return 0;
}
Ejemplo n.º 3
0
void TICC1100::initDevice()
{
	try
	{
		openDevice();
		if(!_fileDescriptor || _fileDescriptor->descriptor == -1) return;

		initChip();
		_out.printDebug("Debug: CC1100: Setting GPIO direction");
		setGPIODirection(1, GPIODirection::IN);
		_out.printDebug("Debug: CC1100: Setting GPIO edge");
		setGPIOEdge(1, GPIOEdge::BOTH);
		openGPIO(1, true);
		if(!_gpioDescriptors[1] || _gpioDescriptors[1]->descriptor == -1) throw(BaseLib::Exception("Couldn't listen to rf device, because the gpio pointer is not valid: " + _settings->device));
		if(gpioDefined(2)) //Enable high gain mode
		{
			openGPIO(2, false);
			if(!getGPIO(2)) setGPIO(2, true);
			closeGPIO(2);
		}
	}
    catch(const std::exception& ex)
    {
        _out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what());
    }
    catch(BaseLib::Exception& ex)
    {
        _out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what());
    }
    catch(...)
    {
        _out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__);
    }
}
Ejemplo n.º 4
0
int main(int argc, char ** argv)
{
  checkIfSudo();
  int vFlag = 0;
  char *iFlag = NULL;
  char *oFlag = NULL;
  char *fFlag = NULL;
  char *errbuf = malloc(PCAP_ERRBUF_SIZE);
  pcap_t *handle = NULL;

  struct bpf_program fp;
  bpf_u_int32 net = 0;  /* The IP of our sniffing device */

  getOptions(argc, argv, &vFlag, &iFlag, &oFlag, &fFlag);

  if(iFlag != NULL)
  {
    printf("****LIVEMODE****\n");
    printf("\n");
    openDevice((u_char*) &fFlag ,&iFlag, &handle, &errbuf);
    pcap_loop(handle, -1 , got_packet, (u_char*) &vFlag);
  }
  else
  {
    printf("*****OFFLINE MODE*****\n");
    printf("\n");
    openOfflineDevice(oFlag, &handle, &errbuf);
    pcap_loop(handle, -1 , got_packet, (u_char*) &vFlag);
  }
  signal(SIGINT,ctrl_c);
  pcap_close(handle);
  return 0;
}
Ejemplo n.º 5
0
// Helper function, perform a sanity check on the device
MediaError MythCDROMFreeBSD::testMedia()
{
    //cout << "MythCDROMLinux::testMedia - ";
    bool OpenedHere = false;
    if (!isDeviceOpen()) 
    {
        //cout << "Device is not open - ";
        if (!openDevice()) 
        {
            //cout << "failed to open device - ";
            if (errno == EBUSY)
            {
                //cout << "errno == EBUSY" << endl;
                return isMounted(true) ? MEDIAERR_OK : MEDIAERR_FAILED;
            } 
            else 
            { 
                return MEDIAERR_FAILED; 
            }
        }
        //cout << "Opened it - ";
        OpenedHere = true;
    }

    // Be nice and close the device if we opened it, otherwise it might be locked when the user doesn't want it to be.
    if (OpenedHere)
        closeDevice();

    return MEDIAERR_OK;
}
Ejemplo n.º 6
0
int COM_Init (int *fd_atcmd, int *fd_uart, int *hUsbComPort)
{
     
    *fd_atcmd = openDevice();
    if(*fd_atcmd == -1) {
		LOGE(TAG "Open ccci port fail\r\n" );
        return *fd_atcmd;
    }
    
    //ATE Tool use 115200 baud rate
    *fd_uart = open_uart_port(UART_PORT1, 115200, 8, 'N', 1);
	if(*fd_uart == -1) {
        LOGE(TAG "Open uart port %d fail\r\n" ,UART_PORT1);
        return *fd_uart;
    }
    else
        LOGD(TAG "Open uart port %d success\r\n" ,UART_PORT1);
  	
           
	//*hUsbComPort = open("/dev/ttyGS0",O_RDWR | O_NOCTTY | /*O_NONBLOCK | */O_NDELAY);
	*hUsbComPort = open_usb_port(UART_PORT1, 115200, 8, 'N', 1);
	if(*hUsbComPort == -1)
	{
		LOGE(TAG "Open usb fail\r\n");
		return *hUsbComPort;
	}
	else
	{
		//initTermIO(*hUsbComPort);
		LOGD(TAG "Open usb success\r\n");
	}

	return 0;
}
int InputDriverAbstract::initialize()
{
	int ret;

	ret = openDevice();
	if (ret < 0) {
		finalize();
		return ret;
	}
	ret = guessDeviceType();
	if (ret < 0) {
		finalize();
		return ret;
	}
	ret = initMapping();
	if (ret < 0) {
		finalize();
		return ret;
	}
	ret = validate();
	if (ret < 0) {
		finalize();
		return ret;
	}
	return 0;
}
//-----------------------------------------------------------------------------
bool HIDDevice::OnDeviceNotification(MessageType messageType,
                                     HIDDeviceDesc* device_info,
                                     bool* error)
{
    const char* device_path = device_info->Path.ToCStr();

    if (messageType == Message_DeviceAdded && DeviceHandle < 0)
    {
        // Is this the correct device?
        if (!(device_info->VendorId == DevDesc.VendorId
            && device_info->ProductId == DevDesc.ProductId
            && device_info->SerialNumber == DevDesc.SerialNumber))
        {
            return false;
        }

        // A closed device has been re-added. Try to reopen.
        if (!openDevice(device_path))
        {
            LogError("OVR::Linux::HIDDevice - Failed to reopen a device '%s' that was re-added.\n", 
                     device_path);
            *error = true;
            return true;
        }

        LogText("OVR::Linux::HIDDevice - Reopened device '%s'\n", device_path);

        if (Handler)
        {
            Handler->OnDeviceMessage(HIDHandler::HIDDeviceMessage_DeviceAdded);
        }
    }
    else if (messageType == Message_DeviceRemoved)
    {
        // Is this the correct device?
        // For disconnected device, the device description will be invalid so
        // checking the path is the only way to match them
        if (DevDesc.Path.CompareNoCase(device_path) != 0)
        {
            return false;
        }

        if (DeviceHandle >= 0)
        {
            closeDevice(true);
        }

        if (Handler)
        {
            Handler->OnDeviceMessage(HIDHandler::HIDDeviceMessage_DeviceRemoved);
        }
    }
    else
    {
        OVR_ASSERT(0);
    }

    *error = false;
    return true;
}
Ejemplo n.º 9
0
bool EepromDev::saveToDevice(void)
{
    bool ret_value = false;
    int fd;
    if (openDevice(fd)) {
        const char *buffer = (const char *)&data_;
        unsigned int buffer_offset = 0;
        int page_size = data_.page_size;
        bool ret;

        while (buffer_offset < sizeof(data_)) {
            if ((buffer_offset + page_size) > sizeof(data_))
                page_size = sizeof(data_) - buffer_offset;

            ret = writeI2C(fd, buffer_offset, (void *)(buffer + buffer_offset),
                            page_size);
            if (!ret) {
                break;
            }

            buffer_offset += page_size;
        }

        ::close(fd);
    }
    else
        ret_value = -1;

    return ret_value;
}
Ejemplo n.º 10
0
int main(int argc, char **argv)
{
usbDevice_t *dev;
char        buffer[4];    /* room for dummy report ID */
int         err;

    if(argc < 2){
        usage(argv[0]);
        exit(1);
    }
    if((dev = openDevice()) == NULL)
        exit(1);
    if(strcasecmp(argv[1], "read") == 0){
        int len = sizeof(buffer);
        if((err = usbhidGetReport(dev, 0, buffer, &len)) != 0){
            fprintf(stderr, "error reading data: %s\n", usbErrorMessage(err));
        }else{
            hexdump(buffer + 1, sizeof(buffer) - 1);
        }
    }else if(strcasecmp(argv[1], "write") == 0){
        int i, pos;
        memset(buffer, 0, sizeof(buffer));
        for(pos = 1, i = 2; i < argc && pos < sizeof(buffer); i++){
            pos += hexread(buffer + pos, argv[i], sizeof(buffer) - pos);
        }
        if((err = usbhidSetReport(dev, buffer, sizeof(buffer))) != 0)   /* add a dummy report ID */
            fprintf(stderr, "error writing data: %s\n", usbErrorMessage(err));
    }else{
        usage(argv[0]);
        exit(1);
    }
    usbhidCloseDevice(dev);
    return 0;
}
Ejemplo n.º 11
0
/**
* @brief 重置USB设备
*/
bool USBControl::resetDevice()
{
	CloseHandle(m_hDevice);
	bool status = openDevice();

	return status;
}
Ejemplo n.º 12
0
BOOL initDialog(HWND hWnd)
{
	HICON   hIcon;
	TC_ITEM tci;
	int     i;

	hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_APP_ICON));
	SendMessage(hWnd, WM_SETICON, (LPARAM) ICON_BIG, (WPARAM) hIcon);
	hURLFont = 0;

	hWndTab = GetDlgItem(hWnd,IDC_TAB);

	ZeroMemory(&tci, sizeof(TC_ITEM));
	tci.mask        = TCIF_TEXT;
	for (i=0;i<NUM_TABS;i++) {
		tci.pszText = tabsName[i];
		if (TabCtrl_InsertItem(hWndTab, i, &tci) == -1) {
			PrintLastError("TabCtrl_InsertItem()");
			return FALSE;
		}
		hWndChild[i] = CreateDialogParam(hInst, MAKEINTRESOURCE(tabsResource[i]), hWndTab, (DLGPROC)TabDlgProc, 0);
	}

	hURLFont = CreateFont(20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, VARIABLE_PITCH | FF_SWISS, "MS Shell Dlg");
	SendMessage(GetDlgItem(hWndChild[NUM_TABS-1], IDC_URL2), WM_SETFONT, (WPARAM)hURLFont, TRUE);

	currentTab = 0;
	ShowWindow(hWndChild[0], SW_SHOWDEFAULT);

	if (!openDevice(TRUE)) {
		PrintLastError("openDevice()");
		return FALSE;
	}
	return setDlgItems(hWnd);
}
Ejemplo n.º 13
0
MidiInput::MidiInput( const char* device, int nvoices )
{
    char tmpname[ 16 ];

    running = 0;
    this->nvoices = nvoices;
    voices = new midi_voice[ nvoices ];
    pthread_mutex_init(&startStopLock, NULL);
    lastNote = -1;

    if ( openDevice( device, MIDI_READ ) < 0 )
	return;
    
    addOutput( "bend", false );

    for( int i = 0; i < nvoices; i++ )
    {
	voices[ i ].note = -1;
	sprintf(tmpname, "sig%d", i);
	voices[ i ].pitchOutput = addOutput(tmpname, false);
	sprintf(tmpname, "amp%d", i);
	voices[ i ].gateOutput = addOutput(tmpname, false);
    }

}
Ejemplo n.º 14
0
bool HIDDevice::HIDInitialize(const String& path)
{

    DevDesc.Path = path;

    if (!openDevice())
    {
        LogText("OVR::OSX::HIDDevice - Failed to open HIDDevice: %s", path.ToCStr());
        return false;
    }

    // Setup notification for when a device is unplugged and plugged back in.
    if (!setupDevicePluggedInNotification())
    {
        LogText("OVR::OSX::HIDDevice - Failed to setup notification for when device plugged back in.");
        closeDevice(false);
        return false;
    }
    
    HIDManager->DevManager->pThread->AddTicksNotifier(this);

    
    LogText("OVR::OSX::HIDDevice - Opened '%s'\n"
            "                    Manufacturer:'%s'  Product:'%s'  Serial#:'%s'\n",
            DevDesc.Path.ToCStr(),
            DevDesc.Manufacturer.ToCStr(), DevDesc.Product.ToCStr(),
            DevDesc.SerialNumber.ToCStr());
    
    return true;
}
Ejemplo n.º 15
0
// Helper function, perform a sanity check on the device
MythMediaError MythCDROMFreeBSD::testMedia()
{
    bool OpenedHere = false;
    if (!isDeviceOpen())
    {
        if (!openDevice())
        {
            if (errno == EBUSY)
            {
                return isMounted() ? MEDIAERR_OK : MEDIAERR_FAILED;
            }
            else
            {
                return MEDIAERR_FAILED;
            }
        }
        OpenedHere = true;
    }

    // Be nice and close the device if we opened it, otherwise it might be locked when the user doesn't want it to be.
    if (OpenedHere)
        closeDevice();

    return MEDIAERR_OK;
}
Ejemplo n.º 16
0
void CVFD::setlcdparameter(int dimm, const int power)
{
	if(!has_lcd) return;

	if(dimm < 0)
		dimm = 0;
	else if(dimm > 15)
		dimm = 15;

	if(!power)
		dimm = 0;

	if(brightness == dimm)
		return;

	brightness = dimm;

printf("CVFD::setlcdparameter dimm %d power %d\n", dimm, power);
#ifdef __sh__
        openDevice();

        struct vfd_ioctl_data data;
	data.start_address = dimm;
	
	int ret = ioctl(fd, VFDBRIGHTNESS, &data);

        closeDevice();
#else
	int ret = ioctl(fd, IOC_VFD_SET_BRIGHT, dimm);
	if(ret < 0)
		perror("IOC_VFD_SET_BRIGHT");
#endif
}
Ejemplo n.º 17
0
int main(int argc, char **argv)
{
	
	if (argc >= 3) {

		float freq = strtof(argv[1], NULL);
		float bandwidth = strtof(argv[2], NULL);
		int decimation = atoi(argv[3]);

		std::cout << "Frequency: " << freq << "\n";
		std::cout << "Bandwidth " << bandwidth << "\n";
		std::cout << "Decimation " << decimation << "\n";

		std::cout << "Opening Signalhound SA device\n";
		int id = openDevice();

		startIQ(id, freq, bandwidth, decimation);

//		startIQ(id, 915.0e6, 50.0e3, 8);

		closeDevice(id);
	}
	else {
		std::cout << "Stream IQ pairs at a particualar frequency\n";
		std::cout << "Usage:\n";

		std::cout << "signalhoundiq frequency bandwidth [decimation]\n";
		std::cout << "Frequency in Hz\n";
		std::cout << "Bandwidth in Hz\n";
		std::cout << "Decimation 1-16 (default 8)\n";
	}
	return 0;
}
Ejemplo n.º 18
0
/**************************************************************************************
Function Name       :   main
Description         :   Read and Write the Password in the EEPROM
Parameters          :   commandline arguments
Return              :   NULL
**************************************************************************************/
int main(int argc, char **argv)
{
usbDevice_t *dev;
char        buffer[129];    /* room for dummy report ID */
int         err;

    if(argc < 2){
        usage(argv[0]);
        exit(1);
    }
    if((dev = openDevice()) == NULL)
        exit(1);
    if(strcasecmp(argv[1], "read") == 0){
        int len = sizeof(buffer);
        if((err = usbhidGetReport(dev, 0, buffer, &len)) != 0){
            fprintf(stderr, "error reading data: %s\n", usbErrorMessage(err));
        }else{
            hexdump(buffer + 1, sizeof(buffer) - 1);
        }
    }else if(strcasecmp(argv[1], "write") == 0){
        memset(buffer, 0, sizeof(buffer));
        int i = 1;
        while(*argv[2] != '\0'){    
            buffer[i] += *argv[2]++;
            i++;
        }
        if((err = usbhidSetReport(dev, buffer, sizeof(buffer))) != 0)   /* add a dummy report ID */
            fprintf(stderr, "error writing data: %s\n", usbErrorMessage(err));
    }else{
        usage(argv[0]);
        exit(1);
    }
    usbhidCloseDevice(dev);
    return 0;
}
Ejemplo n.º 19
0
void NewSerialDeviceDialog::setupUI()
{
    this->setWindowTitle("Open serial port");

    QVBoxLayout* layout = new QVBoxLayout();
    QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Open | QDialogButtonBox::Cancel, Qt::Horizontal, this);

    connect(buttons, SIGNAL(accepted()), this, SLOT(openDevice()));
    connect(buttons, SIGNAL(rejected()), this, SLOT(reject()));

    QFormLayout* form = new QFormLayout();
    form->addRow("Device", device = new QComboBox(this));
    form->addRow("Baudrate", baudrate = new QComboBox(this));
    form->addRow("Parity", parity = new QComboBox(this));
    form->addRow("Data Bits", dataBits = new QComboBox(this));
    form->addRow("Stop Bits", stopBits = new QComboBox(this));
    form->addRow("Flow Control", flowControl = new QComboBox(this));
    form->addRow("Read Only", readOnly = new QCheckBox(this));



    layout->addLayout(form, 80);
    layout->addWidget(buttons, 20, Qt::AlignBottom);


    setLayout(layout);
    //update data
    Q_FOREACH(QSerialPortInfo info, QSerialPortInfo::availablePorts())
    {
        this->device->addItem(info.portName(), QVariant::fromValue(info));
    }
Ejemplo n.º 20
0
/*	player thread; for every song a new thread is started
 *	@param audioPlayer structure
 *	@return PLAYER_RET_*
 */
void *BarPlayerThread (void *data) {
	assert (data != NULL);

	player_t * const player = data;
	uintptr_t pret = PLAYER_RET_OK;

	bool retry;
	do {
		retry = false;
		if (openStream (player)) {
			if (openFilter (player) && openDevice (player)) {
				player->mode = PLAYER_PLAYING;
				BarPlayerSetVolume (player);
				retry = play (player) == AVERROR_INVALIDDATA &&
						!player->interrupted;
			} else {
				/* filter missing or audio device busy */
				pret = PLAYER_RET_HARDFAIL;
			}
		} else {
			/* stream not found */
			pret = PLAYER_RET_SOFTFAIL;
		}
		player->mode = PLAYER_WAITING;
		finish (player);
	} while (retry);

	player->mode = PLAYER_FINISHED;

	return (void *) pret;
}
Ejemplo n.º 21
0
/* ------------------------------------------------------------------------- */
usb_dev_handle* hidtool_open(void){
    usb_dev_handle *dev;
    if((dev = openDevice()) == NULL){
        fprintf(stderr, "Can not open device.\n");
        exit(1);
    }
    return dev;
}
Ejemplo n.º 22
0
cAudio::cAudio(void *, void *, void *)
{
	fd = -1;
	clipfd = -1;
	mixer_fd = -1;
	openDevice();
	Muted = false;
}
Ejemplo n.º 23
0
int USBLink::open()
{
  close();

  libusb_init(&m_context);

  return openDevice();
}
Ejemplo n.º 24
0
int usb_open( t_usbInterface* usbInt )
{		
  //--------------------------------------- Mac-only -------------------------------
  #ifndef WIN32
  
  if( usbInt->deviceOpen )  //if it's already open, do nothing.
    return MC_ALREADY_OPEN;

  int result = FindUsbSerialDevice( &usbInt->deviceName, 0 );
  //if( result );  //should return 0 on success
  //return; 
		
  // now try to actually do something
  usbInt->deviceHandle = open( usbInt->deviceName, O_RDWR | O_NOCTTY | ( ( usbInt->blocking ) ? 0 : O_NDELAY ) );
  if ( usbInt->deviceHandle < 0 )
  {
    //post( "Could not open the port (Error %d)\n", usbInt->deviceHandle );
    return MC_NOT_OPEN;
  } else
  {
    usbInt->deviceOpen = true;
	usleep( 10000 ); //give it a moment after opening before trying to read/write
	//post( "USB opened at %s, deviceHandle = %d", usbInt->deviceName, usbInt->deviceHandle);
	post( "mc.usb opened." );
  }
  return MC_OK;
  #endif
		
  //--------------------------------------- Windows-only -------------------------------
  
#ifdef WIN32
  TCHAR* openPorts[32];
  int i;
  int foundOpen;

  if( usbInt->deviceOpen )  //if it's already open, do nothing.
    return MC_ALREADY_OPEN;

  foundOpen = ScanEnumTree( usbInt, TEXT("SYSTEM\\CURRENTCONTROLSET\\ENUM\\USB"), openPorts);
  //post( "Found %d ports open", foundOpen );

  for( i = 0; i < foundOpen; i++ )
  {
    if( openPorts[i] != NULL )
	{
	  if( openDevice( usbInt, openPorts[i] ) == 0 )
	  {
		post( "mc.usb opened at: %s", openPorts[i] );
		Sleep( 10 );  // wait after opening it before trying to read/write
		usbInt->deviceOpen = true;
		return MC_OK;
	  }
	}
  }
  //post( "mc.usb did not open." );
  return MC_NOT_OPEN;
  #endif
}
Ejemplo n.º 25
0
Device* DeviceManager::getAnyDevice()
{
  Device* pDevice = getCurrentDevice();
  if (pDevice == NULL) {
    openDevice();
    pDevice = getCurrentDevice();
  }
  return pDevice;
}
Ejemplo n.º 26
0
    BlockDevice(const std::string& name, const Mode mode, bool isDirect)
        : name_(name)
        , mode_(mode)
        , fd_(openDevice(name, mode, isDirect))
        , deviceSize_(getDeviceSizeFirst()) {
#if 0
        ::printf("device %s size %zu mode %d isDirect %d\n",
                 name_.c_str(), size_, mode_, isDirect_);
#endif
    }
Ejemplo n.º 27
0
void V4L::init(const CameraProps & props) {
    dev_name = "/dev/" + props.device;

    if (openDevice()) {
        getDeviceCapabilities();
        getVideoProperty(0);
        getBufferSize();

    } else
        LOG(LERROR) << "function: V4L\n";
}
Ejemplo n.º 28
0
MythMediaError MythCDROMFreeBSD::eject(bool open_close)
{
    if (!isDeviceOpen())
        openDevice();

    if (open_close)
        return (ioctl(m_DeviceHandle, CDIOCEJECT) == 0) ? MEDIAERR_OK :
                                                          MEDIAERR_FAILED;
    else
        return MEDIAERR_UNSUPPORTED;
}
int V4L2JpegEncoder::run(void)
{
	int ret;
	sp<Buffer> thumbData;
	sp<Buffer> exifData;

	TRACE();

	ret = openDevice();
	if (ret < 0) {
		ERR("Failed to open JPEG encoder device");
		return -1;
	}

	if (thumbnail.allocation != 0) {
		ret = encodeImage(&thumbnail);
		if (ret >= 0) {
			V4L2Buffer *buf =
					output.allocation->getBuffer(0);
			thumbData = new Buffer(buf->getUsed(),
							buf->getAddress());
		}
	}

	ret = encodeImage(&input);
	if (ret < 0) {
		ERR("Failed to encode JPEG image");
		closeDevice();
		return -1;
	}

	closeDevice();

	uint32_t exifSize = EXIF_SIZE;
	if (thumbData != 0)
		exifSize += thumbData->getSize();

	exifData = new Buffer(exifSize);
	if (exifData == 0 || !exifData->initCheck()) {
		ERR("Failed to allocate exif buffer");
		return -1;
	}
	exifData->zero();

	exifSize = buildExif(exifData, thumbData);

	V4L2Buffer *buf = output.allocation->getBuffer(0);
	char *addr = (char *)buf->getAddress();
	memmove(addr + exifSize, addr, buf->getUsed());
	memcpy(addr, addr + exifSize, 2);
	memcpy(addr + 2, exifData->getData(), exifSize);

	return buf->getUsed() + exifSize;
}
Ejemplo n.º 30
0
/* 
 Scan the available ports & populate the list.
 If one of the ports is the one that was last open, open it up.
 Otherwise, wait for the user to select one then open that one.
*/
bool UsbConsole::loadAndShow( )
{
  if(!portList->currentText().isEmpty())
    openDevice(portList->currentText());
  enumerate();
#ifndef Q_WS_WIN
  enumerateTimer.start(ENUM_FREQUENCY); // makes Windows unhappy...problem with enumerator
#endif
  this->show();
  return true;
}