Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
controller_leds(3)		 Arcan Lua API		    controller_leds(3)

NAME
       controller_leds - Query or rescan for LED controllers

SYNOPSIS
       [nleds, variable, rgb] or [nctrls, low32, high32]
       controller_leds(

       ctrlid )

DESCRIPTION
       If  ctrlid    is	 set,  the values for the specified controller are re-
       turned. The id of a controller can be retrieved as part of  the	_input
       event handler on	status == "added" events either	directly on devkind ==
       "led"  or  for  some  other  devices  through  the  devref field. _dis-
       play_state events may also provide a ledctrl,ledind. If ctrlid  is  not
       set  or	set  to	 -1, a rescan will be queued that might	generate addi-
       tional device status events. It also returns the	number of active  con-
       trollers	and two	bitmasks (capped to 64 controllers)

EXAMPLE
       function	controller_leds0()
	     local do_ctrl = function(i)
		   local nleds,	shift, rgb = controller_leds(i);
		   print("controller", i, "leds:", nleds,
			 "intensity:", intensity and "yes" or "no",
			 "rgb:", rgb and "yes" or "no");
	     end
       -- due to the double size restriction, this had to be split
	     local count, first, second	= controller_leds();
	     print("# controllers:", count);
	     for i=0, 31 do
		   if (bit.band(first, bit.lshift(1, i))) then
			 do_ctrl(i);
		   end
	     end
	     for i=0, 31 do
		   if (bit.band(first, bit.lshift(1, i))) then
			 do_ctrl(32, i);
		   end
	     end
       end

iodev				  April	2025		    controller_leds(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=controller_leds&sektion=3&manpath=FreeBSD+Ports+14.3.quarterly>

home | help