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]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux