null_usb.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /*
  2. * Copyright © 2019 Pino Toscano <toscano.pino@tiscali.it>
  3. *
  4. * This library is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Lesser General Public
  6. * License as published by the Free Software Foundation; either
  7. * version 2.1 of the License, or (at your option) any later version.
  8. *
  9. * This library is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public
  15. * License along with this library; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  17. */
  18. #include "libusbi.h"
  19. static int
  20. null_get_device_list(struct libusb_context * ctx,
  21. struct discovered_devs **discdevs)
  22. {
  23. return LIBUSB_SUCCESS;
  24. }
  25. static int
  26. null_open(struct libusb_device_handle *handle)
  27. {
  28. return LIBUSB_ERROR_NOT_SUPPORTED;
  29. }
  30. static void
  31. null_close(struct libusb_device_handle *handle)
  32. {
  33. }
  34. static int
  35. null_get_active_config_descriptor(struct libusb_device *dev,
  36. void *buf, size_t len)
  37. {
  38. return LIBUSB_ERROR_NOT_SUPPORTED;
  39. }
  40. static int
  41. null_get_config_descriptor(struct libusb_device *dev, uint8_t idx,
  42. void *buf, size_t len)
  43. {
  44. return LIBUSB_ERROR_NOT_SUPPORTED;
  45. }
  46. static int
  47. null_set_configuration(struct libusb_device_handle *handle, int config)
  48. {
  49. return LIBUSB_ERROR_NOT_SUPPORTED;
  50. }
  51. static int
  52. null_claim_interface(struct libusb_device_handle *handle, uint8_t iface)
  53. {
  54. return LIBUSB_ERROR_NOT_SUPPORTED;
  55. }
  56. static int
  57. null_release_interface(struct libusb_device_handle *handle, uint8_t iface)
  58. {
  59. return LIBUSB_ERROR_NOT_SUPPORTED;
  60. }
  61. static int
  62. null_set_interface_altsetting(struct libusb_device_handle *handle, uint8_t iface,
  63. uint8_t altsetting)
  64. {
  65. return LIBUSB_ERROR_NOT_SUPPORTED;
  66. }
  67. static int
  68. null_clear_halt(struct libusb_device_handle *handle, unsigned char endpoint)
  69. {
  70. return LIBUSB_ERROR_NOT_SUPPORTED;
  71. }
  72. static int
  73. null_submit_transfer(struct usbi_transfer *itransfer)
  74. {
  75. return LIBUSB_ERROR_NOT_SUPPORTED;
  76. }
  77. static int
  78. null_cancel_transfer(struct usbi_transfer *itransfer)
  79. {
  80. return LIBUSB_ERROR_NOT_SUPPORTED;
  81. }
  82. const struct usbi_os_backend usbi_backend = {
  83. .name = "Null backend",
  84. .caps = 0,
  85. .get_device_list = null_get_device_list,
  86. .open = null_open,
  87. .close = null_close,
  88. .get_active_config_descriptor = null_get_active_config_descriptor,
  89. .get_config_descriptor = null_get_config_descriptor,
  90. .set_configuration = null_set_configuration,
  91. .claim_interface = null_claim_interface,
  92. .release_interface = null_release_interface,
  93. .set_interface_altsetting = null_set_interface_altsetting,
  94. .clear_halt = null_clear_halt,
  95. .submit_transfer = null_submit_transfer,
  96. .cancel_transfer = null_cancel_transfer,
  97. };