Game controller HID

Trying to figure out how to take advantage of a game controller to quickly send data to a running pattern. Started with a prof of concept one to keep it simple, but I’m stuck cause i can only use one of the controller’s sticks, left one. This below works, but how do i access the rest of the features/controls (the right stick, trigger buttons, d-pad, etc)? It’s my first time using HID stuff. Checked documentation but I could not figure it out, sorry if it’s supposed to be obvious.

MIDIClient.init;
~outport1 = 0; m = MIDIOut(~outport1);
~myhid = HID.open(121, 6172); 


~k1 = 1; ~n1 = 4; Pdefn(\amp1, Pseq(Bjorklund(~k1, ~n1).postln, inf)); 

Pdef(\x, Pbind(\type, \midi, \chan, 0, \midicmd, \noteOn, \midiout, m, \midinote, 49, \dur, 0.12, \amp, Pdefn(\amp1))).play; 

HIDdef.usage( \amp, { |value| ~k1 = value.linexp(0, 1, 1, 12); ~n1 = value.linlin(0, 1, 3, 20); Pdefn(\amp1, Pseq(Bjorklund(~k1, ~n1).postln, inf)) }, \X );

CHEERS!

I tried something like this once, but not with HIDdef. This is the old code I found, I think it sort of worked. Will likely have to be adapted for your controller. I seem to have gone through the trouble of just figuring out the usage values by trial and error…

~pad = HID.open(1133, 49688) //the logitech rumble bs
~pad.action = {|value, placeholder, rawValue, placeholder2, usage|
	case
	{usage == 57} {["arrows", rawValue].postln;}
	{usage <= 12} {["button"++usage, rawValue].postln;}
	{usage == 48} {["LX", value].postln;}
	{usage == 49} {["LY", 1-value].postln;}
	{usage == 50} {["RX", value].postln;}
	{usage == 53} {["RY", 1-value].postln;};
};