Re: How would I get the raw data from a USB device ? (Transmitter USB adapter driver)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Nevermind... this works:

/*

============================================================================
 Name        : TransmitterAdapter.c
 Author      :
 Version     :
 Copyright   : 
 Description : 

============================================================================
 */

#include <stdio.h>
#include <stdlib.h>

int main(void) {
	printf("Transmitter Adapter Tester version 0.1\n");

	// open the joystick file
	FILE *joystick;

	joystick = fopen("/dev/input/js0", "rb");

	if (joystick == NULL)
		{
		printf("Joystick device file could not be opened.\n");
		printf("Exiting.\n");
		return(-1);
		}// if

	// now read a bunch of data and display it
	int i;
	int val;

	for (i=0;i<100;i++)
		{
		val = fgetc(joystick);
		printf("%2X\n", val);
		}

	exit(0);


	while (1)
		{
		for (i=0; i<8;i++)
			{
			val = fgetc(joystick);
			printf("%2X ", val);

			val = fgetc(joystick);
			printf("%2X ", val);

			val = fgetc(joystick);
			printf("%2X ", val);

			val = fgetc(joystick);
			printf("%2X ", val);

			val = fgetc(joystick);
			printf("%2X ", val);

			val = fgetc(joystick);
			printf("%2X ", val);

			val = fgetc(joystick);
			printf("%2X ", val);

			val = fgetc(joystick);
			printf("%2X \r", val);

			}//for
		}// while(1)

	return EXIT_SUCCESS;
}// End of main()


-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines

[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux