Advertisement
z3ntu

razer structs unions

Jul 15th, 2018
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.96 KB | None | 0 0
  1. union transaction_id_union {
  2.     unsigned char id;
  3.     struct transaction_parts {
  4.         unsigned char device : 3;
  5.         unsigned char id : 5;
  6.     } parts;
  7. };
  8.  
  9. union command_id_union {
  10.     unsigned char id;
  11.     struct command_id_parts {
  12.         unsigned char direction : 1;
  13.         unsigned char id : 7;
  14.     } parts;
  15. };
  16.  
  17. typedef union razer_report {
  18.     unsigned char Data[90];
  19.     struct {
  20.         unsigned char report_id; /* required by hidraw or something - 0x00 */
  21.         unsigned char status;
  22.         union transaction_id_union transaction_id; /* */
  23.         unsigned short remaining_packets; /* Big Endian */
  24.         unsigned char protocol_type; /*0x0*/
  25.         unsigned char data_size;
  26.         unsigned char command_class;
  27.         union command_id_union command_id;
  28.         unsigned char arguments[80];
  29.         unsigned char crc;/*xor'ed bytes of report*/
  30.         unsigned char reserved; /*0x0*/
  31.     } razer_report_inner;
  32. } razer_report;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement