Exemple #1
0
static int ehci_waiter(int argc, char *argv[])
{
  FAR struct usbhost_hubport_s *hport;

  uinfo("ehci_waiter:  Running\n");
  for (;;)
    {
      /* Wait for the device to change state */

      DEBUGVERIFY(CONN_WAIT(g_ehciconn, &hport));
      syslog(LOG_INFO, "ehci_waiter: %s\n",
             hport->connected ? "connected" : "disconnected");

      /* Did we just become connected? */

      if (hport->connected)
        {
          /* Yes.. enumerate the newly connected device */

          (void)CONN_ENUMERATE(g_ehciconn, hport);
        }
    }

  /* Keep the compiler from complaining */

  return 0;
}
Exemple #2
0
static int nsh_waiter(int argc, char *argv[])
{
  bool connected = false;
  int ret;

  message("nsh_waiter: Running\n");
  for (;;)
    {
      /* Wait for the device to change state */

      ret = CONN_WAIT(g_usbconn, &connected);
      DEBUGASSERT(ret == OK);

      connected = !connected;
      message("nsh_waiter: %s\n", connected ? "connected" : "disconnected");

      /* Did we just become connected? */

      if (connected)
        {
          /* Yes.. enumerate the newly connected device */

          (void)CONN_ENUMERATE(g_usbconn, 0);
        }
    }

  /* Keep the compiler from complaining */

  return 0;
}
Exemple #3
0
static int usbhost_waiter(struct usbhost_connection_s *dev)
#endif
{
  struct usbhost_hubport_s *hport;

  uinfo("Running\n");
  for (;;)
    {
      /* Wait for the device to change state */

      DEBUGVERIFY(CONN_WAIT(dev, &hport));
      uinfo("%s\n", hport->connected ? "connected" : "disconnected");

      /* Did we just become connected? */

      if (hport->connected)
        {
          /* Yes.. enumerate the newly connected device */

          (void)CONN_ENUMERATE(dev, hport);
        }
    }

  /* Keep the compiler from complaining */

  return 0;
}
Exemple #4
0
static void* usbhost_detect(void *arg)
{
  (void)arg;
  struct usbhost_hubport_s *hport;

  uinfo("INFO: Starting usb detect thread\n");

  for (;;)
    {
      CONN_WAIT(g_usbconn, &hport);

      if (hport->connected)
        {
          CONN_ENUMERATE(g_usbconn, hport);
        }
    }

  return 0;
}
Exemple #5
0
static int usbhost_waiter(struct usbhost_connection_s *dev)
#endif
{
  bool connected[SAM_OHCI_NRHPORT] = {false, false, false};
  int rhpndx;
  int ret;

  uvdbg("%s Waiter Running\n", hcistr);
  for (;;)
    {
      /* Wait for the device to change state */

      rhpndx = CONN_WAIT(dev, connected);
      DEBUGASSERT(rhpndx >= 0 && rhpndx < SAM_OHCI_NRHPORT);

      connected[rhpndx] = !connected[rhpndx];

      uvdbg("%s RHport%d %s\n",
            hcistr, rhpndx + 1, connected[rhpndx] ? "connected" : "disconnected");

      /* Did we just become connected? */

      if (connected[rhpndx])
        {
          /* Yes.. enumerate the newly connected device */

          ret = CONN_ENUMERATE(dev, rhpndx);
          if (ret < 0)
            {
              uvdbg("%s RHport%d CONN_ENUMERATE failed: %d\n", hcistr, rhpndx+1, ret);
              connected[rhpndx] = false;
            }
        }
    }

  /* Keep the compiler from complaining */

  return 0;
}