sunos_usb.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. *
  3. * Copyright (c) 2016, Oracle and/or its affiliates.
  4. *
  5. * This library is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU Lesser General Public
  7. * License as published by the Free Software Foundation; either
  8. * version 2.1 of the License, or (at your option) any later version.
  9. *
  10. * This library is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * Lesser General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Lesser General Public
  16. * License along with this library; if not, write to the Free Software
  17. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  18. */
  19. #ifndef LIBUSB_SUNOS_H
  20. #define LIBUSB_SUNOS_H
  21. #include <libdevinfo.h>
  22. #include <pthread.h>
  23. #include "libusbi.h"
  24. #define READ 0
  25. #define WRITE 1
  26. typedef struct sunos_device_priv {
  27. uint8_t cfgvalue; /* active config value */
  28. uint8_t *raw_cfgdescr; /* active config descriptor */
  29. char *ugenpath; /* name of the ugen(4) node */
  30. char *phypath; /* physical path */
  31. } sunos_dev_priv_t;
  32. typedef struct endpoint {
  33. int datafd; /* data file */
  34. int statfd; /* state file */
  35. } sunos_ep_priv_t;
  36. typedef struct sunos_device_handle_priv {
  37. uint8_t altsetting[USB_MAXINTERFACES]; /* a interface's alt */
  38. uint8_t config_index;
  39. sunos_ep_priv_t eps[USB_MAXENDPOINTS];
  40. sunos_dev_priv_t *dpriv; /* device private */
  41. } sunos_dev_handle_priv_t;
  42. typedef struct sunos_transfer_priv {
  43. struct aiocb aiocb;
  44. struct libusb_transfer *transfer;
  45. } sunos_xfer_priv_t;
  46. struct node_args {
  47. struct libusb_context *ctx;
  48. struct discovered_devs **discdevs;
  49. const char *last_ugenpath;
  50. di_devlink_handle_t dlink_hdl;
  51. };
  52. struct devlink_cbarg {
  53. struct node_args *nargs; /* di node walk arguments */
  54. di_node_t myself; /* the di node */
  55. di_minor_t minor;
  56. };
  57. typedef struct walk_link {
  58. char *path;
  59. int len;
  60. char **linkpp;
  61. } walk_link_t;
  62. /* AIO callback args */
  63. struct aio_callback_args{
  64. struct libusb_transfer *transfer;
  65. struct aiocb aiocb;
  66. };
  67. #endif /* LIBUSB_SUNOS_H */