Changeset 290 in flair-src


Ignore:
Timestamp:
Jan 8, 2019, 5:45:23 PM (22 months ago)
Author:
Sanahuja Guillaume
Message:

support for multiple ds3 in usb

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/FlairCore/src/FrameworkManager_impl.cpp

    r272 r290  
    226226
    227227  // socket file_socket, doit être créé en premier, cf station sol
    228   Printf("Connecting to %s:%i\n", address.c_str(), port);
     228  Printf("Connecting to FlairGCS on %s:%i\n", address.c_str(), port);
    229229  //file_sock = GetSocket(address, port);
    230230  com_sock = GetSocket();
  • trunk/lib/FlairSensorActuator/src/HostEthController.cpp

    r243 r290  
    4949      bitsPerAxis(_bitsPerAxis), dataFrameBuffer(NULL),
    5050      meaningfulDataAvailable(false) {
     51       
     52  Thread::Info("Trying to connect to %s:%d\n", targetAddress.c_str(), targetPort);
     53 
    5154  tabWidget = new TabWidget(tab->NewRow(), name);
    5255
  • trunk/tools/Controller/DualShock3/src/DualShock3.cpp

    r214 r290  
    3939#include <bluetooth/hci.h>
    4040#include <bluetooth/hci_lib.h>
     41#include <sys/file.h>
    4142
    4243#define USB_DIR_IN 0x80
     
    156157      dev_name << "/dev/hidraw" << i;
    157158      if ((usb_fd = open(dev_name.str().c_str(), O_RDONLY)) >= 0) {
    158         int res = 0;
     159        int res=flock(usb_fd, LOCK_EX|LOCK_NB);
     160        if(res<0) {
     161          Thread::Warn("%s seems to be locked by another application\n", dev_name.str().c_str());
     162          close(usb_fd);
     163          continue;
     164        }
     165       
    159166        struct hidraw_devinfo info;
    160 
    161167        res = ioctl(usb_fd, HIDIOCGRAWINFO, &info);
    162168        if (res < 0) {
    163           Thread::Err("ioctl error (HIDIOCGRAWINFO) on %s\n",
    164                       dev_name.str().c_str());
     169          Thread::Err("ioctl error (HIDIOCGRAWINFO) on %s\n",dev_name.str().c_str());
    165170        } else {
    166171          // Printf("%x %x\n", info.vendor, info.product);
     
    171176          }
    172177        }
     178        flock(usb_fd, LOCK_UN);
    173179        close(usb_fd);
    174180      }
     
    193199DualShock3::~DualShock3() {
    194200  if (connectionType == Usb) {
     201    flock(usb_fd, LOCK_UN);
    195202    close(usb_fd);
    196203  }
Note: See TracChangeset for help on using the changeset viewer.