steamcontroller icon indicating copy to clipboard operation
steamcontroller copied to clipboard

Suggestion: Add feature to read dates

Open Fighter19 opened this issue 9 years ago • 1 comments

I have did a small program to create some rumble and to read the dates of the controller some time ago, I'll just share what I didn't find here. To setup the controller, send the control transfer 83 followed by 00s to reset (?) the controller. (I'll just paste in my C++ Code)

  uint8_t data[64] = {0};
  data[0] = 0x83;//Service Mode (?), maybe also reset, however trackball feeling doesn't get reset

  return libusb_control_transfer(handle, 0x21, 0x09, 0x0300, 0x0002, data, 64, 0);

Then you can get the Date from the package the controller will send.

  int i;
  int time = 0;
  uint8_t data[64] = {0};
  uint8_t offset = 23;
  libusb_control_transfer(handle, 0xa1, 0x01, 0x0300, 0x0002, data, 64, 0);

  for (i=0; i<4; i++)
  {
    time += data[i+offset] << (8*(i));
  }
  return time;

Then you receive the time as unix timestamp, and you will only have to convert it. The offset is there to also receive other dates which are stored inside the controller. The other dates are 4 bytes long and between them there is a padding of 1 byte (resulting in 5 bytes). The other (unknown) dates are at the offset 18 and 28. EDIT: I know this is unlikely to fit into a driver, but I wanted to share that, as it is an interesting thing to know. Oh and I suggest wireshark to get the packages, because it has a great UI, which also explains which flags do more or less what.

Fighter19 avatar Nov 29 '15 18:11 Fighter19

I know this is unlikely to fit into a driver, but I wanted to share that, as it is an interesting thing to know.

Is there any place to gather and share knowledge on the steam controller? I would be interested to help, but I only know of this repository. And it would be nice if I had not to find again by myself what is already known.

cvuchener avatar Jan 08 '16 12:01 cvuchener