pid.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * PID Force feedback support for hid devices.
  3. *
  4. * Copyright (c) 2002 Rodrigo Damazio.
  5. */
  6. /*
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  20. *
  21. * Should you need to contact me, the author, you can do so by
  22. * e-mail - mail your message to <rdamazio@lsi.usp.br>
  23. */
  24. #define FF_EFFECTS_MAX 64
  25. #define FF_PID_FLAGS_USED 1 /* If the effect exists */
  26. #define FF_PID_FLAGS_UPDATING 2 /* If the effect is being updated */
  27. #define FF_PID_FLAGS_PLAYING 3 /* If the effect is currently being played */
  28. #define FF_PID_FALSE 0
  29. #define FF_PID_TRUE 1
  30. struct hid_pid_effect {
  31. unsigned long flags;
  32. pid_t owner;
  33. unsigned int device_id; /* The device-assigned ID */
  34. struct ff_effect effect;
  35. };
  36. struct hid_ff_pid {
  37. struct hid_device *hid;
  38. unsigned long gain;
  39. struct urb *urbffout;
  40. struct usb_ctrlrequest ffcr;
  41. spinlock_t lock;
  42. unsigned char ctrl_buffer[8];
  43. struct hid_pid_effect effects[FF_EFFECTS_MAX];
  44. };
  45. /*
  46. * Constants from the PID usage table (still far from complete)
  47. */
  48. #define FF_PID_USAGE_BLOCK_LOAD 0x89UL
  49. #define FF_PID_USAGE_BLOCK_FREE 0x90UL
  50. #define FF_PID_USAGE_NEW_EFFECT 0xABUL
  51. #define FF_PID_USAGE_POOL_REPORT 0x7FUL