Simple manner to read 1-pin high/low from USB under FBSD?

Trevor Blackwell tlb at tlb.org
Sun Oct 11 17:35:50 UTC 2009


Try Phidgets. http://phidgets.com. It's easy to read digital signals  
as a HID device. You can get started with not much more than:

	fd=open("/dev/uhidN",...)
	while (1) {
		char buf[8];
		read(fd, buf, 8);
		int input_signal = (buf[X]>>Y)&1;
		printf("%d\n", input_signal)
	}

for some values of N, X and Y. You can get more general if you want.

--
Trevor Blackwell		650 776 7870	tlb at tlb.org





On Oct 11, 2009, at 9:56 AM, Sven Hazejager wrote:

> On Sun, 11 Oct 2009, Hans Petter Selasky wrote:
>
>>> Thanks for your reply, would I need some GPIO device like this:
>>> http://www.fivemanconspiracy.com/node/45
>>
>> I don't know. You need to ask the manufacturer. Ask them if  the  
>> control
>> endpoint is used to turn on/off the pin(s) you want.
>
> Well, I only need to read high/low, not to set anything... I've  
> mailed the manufacturer for info, thanks for suggesting.
>
> Sven
> _______________________________________________
> freebsd-usb at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-usb
> To unsubscribe, send any mail to "freebsd-usb-unsubscribe at freebsd.org"



More information about the freebsd-usb mailing list