adb.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * Definitions for ADB (Apple Desktop Bus) support.
  3. */
  4. #ifndef __ADB_H
  5. #define __ADB_H
  6. #include <uapi/linux/adb.h>
  7. struct adb_request {
  8. unsigned char data[32];
  9. int nbytes;
  10. unsigned char reply[32];
  11. int reply_len;
  12. unsigned char reply_expected;
  13. unsigned char sent;
  14. unsigned char complete;
  15. void (*done)(struct adb_request *);
  16. void *arg;
  17. struct adb_request *next;
  18. };
  19. struct adb_ids {
  20. int nids;
  21. unsigned char id[16];
  22. };
  23. /* Structure which encapsulates a low-level ADB driver */
  24. struct adb_driver {
  25. char name[16];
  26. int (*probe)(void);
  27. int (*init)(void);
  28. int (*send_request)(struct adb_request *req, int sync);
  29. int (*autopoll)(int devs);
  30. void (*poll)(void);
  31. int (*reset_bus)(void);
  32. };
  33. /* Values for adb_request flags */
  34. #define ADBREQ_REPLY 1 /* expect reply */
  35. #define ADBREQ_SYNC 2 /* poll until done */
  36. #define ADBREQ_NOSEND 4 /* build the request, but don't send it */
  37. /* Messages sent thru the client_list notifier. You should NOT stop
  38. the operation, at least not with this version */
  39. enum adb_message {
  40. ADB_MSG_POWERDOWN, /* Currently called before sleep only */
  41. ADB_MSG_PRE_RESET, /* Called before resetting the bus */
  42. ADB_MSG_POST_RESET /* Called after resetting the bus (re-do init & register) */
  43. };
  44. extern struct blocking_notifier_head adb_client_list;
  45. int adb_request(struct adb_request *req, void (*done)(struct adb_request *),
  46. int flags, int nbytes, ...);
  47. int adb_register(int default_id,int handler_id,struct adb_ids *ids,
  48. void (*handler)(unsigned char *, int, int));
  49. int adb_unregister(int index);
  50. void adb_poll(void);
  51. void adb_input(unsigned char *, int, int);
  52. int adb_reset_bus(void);
  53. int adb_try_handler_change(int address, int new_id);
  54. int adb_get_infos(int address, int *original_address, int *handler_id);
  55. #endif /* __ADB_H */