f_mtp.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * Gadget Function Driver for MTP
  3. *
  4. * Copyright (C) 2010 Google, Inc.
  5. * Author: Mike Lockwood <lockwood@android.com>
  6. *
  7. * This software is licensed under the terms of the GNU General Public
  8. * License version 2, as published by the Free Software Foundation, and
  9. * may be copied, distributed, and modified under those terms.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. */
  17. #ifndef _UAPI_LINUX_USB_F_MTP_H
  18. #define _UAPI_LINUX_USB_F_MTP_H
  19. #include <linux/ioctl.h>
  20. #include <linux/types.h>
  21. struct mtp_file_range {
  22. /* file descriptor for file to transfer */
  23. int fd;
  24. /* offset in file for start of transfer */
  25. loff_t offset;
  26. /* number of bytes to transfer */
  27. int64_t length;
  28. /* MTP command ID for data header,
  29. * used only for MTP_SEND_FILE_WITH_HEADER
  30. */
  31. uint16_t command;
  32. /* MTP transaction ID for data header,
  33. * used only for MTP_SEND_FILE_WITH_HEADER
  34. */
  35. uint32_t transaction_id;
  36. };
  37. struct mtp_event {
  38. /* size of the event */
  39. size_t length;
  40. /* event data to send */
  41. void *data;
  42. };
  43. /* Sends the specified file range to the host */
  44. #define MTP_SEND_FILE _IOW('M', 0, struct mtp_file_range)
  45. /* Receives data from the host and writes it to a file.
  46. * The file is created if it does not exist.
  47. */
  48. #define MTP_RECEIVE_FILE _IOW('M', 1, struct mtp_file_range)
  49. /* Sends an event to the host via the interrupt endpoint */
  50. #define MTP_SEND_EVENT _IOW('M', 3, struct mtp_event)
  51. /* Sends the specified file range to the host,
  52. * with a 12 byte MTP data packet header at the beginning.
  53. */
  54. #define MTP_SEND_FILE_WITH_HEADER _IOW('M', 4, struct mtp_file_range)
  55. #endif /* _UAPI_LINUX_USB_F_MTP_H */