<commit_before>#include <stdlib.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>

#include "hidapi.h"
#include "temper_type.h"

int main( int argc, char **argv )
{
	struct hid_device_info *devs, *info;
	bool list_all = false;
	int i;
	
	for ( i = 1; i < argc; i++ )
	{
		if ( strcmp( "-a", argv[i] ) == 0 )
		{
			list_all = true;
		}
	}
	
	if ( hid_init() != 0 )
	{
		fprintf( stderr, "Could not initialize the HID API.\n" );
		return 1;
	}
	devs = hid_enumerate( 0, 0 );
	if ( !devs )
	{
		printf( "No HID devices were found.\n" );
	}
	for ( info = devs; info; info = info->next )
	{
		temper_type* type = get_temper_type( info );
		if ( list_all || ( type != NULL && !type->ignored ) )
		{
			printf(
				"Device %04hx:%04hx if %d rel %4hx | %s | %ls %ls\n",
				info->vendor_id, info->product_id,
				info->interface_number, info->release_number,
				info->path,
				info->manufacturer_string, info->product_string
			);
			if ( list_all )
			{
				/* Usage and usage page is only valid on Windows/Mac :(
				if ( info->usage_page != 0 || info->usage != 0 )
				{
					printf(
						"\tUsage page %hd, usage %hd\n",
						info->usage_page, info->usage
					);
				}
				// */
				if ( info->serial_number != NULL )
				{
					printf( "\tSerial number: %ls\n", info->serial_number );
				}
			}
			if ( list_all && type != NULL )
			{
				if ( type->ignored )
				{
					printf(
						"\tRecognized as ignored part of: %s\n", type->name
					);
				}
				else
				{
					printf( "\tRecognized as: %s\n", type->name );
				}
			}
		}
	}
	hid_free_enumeration( devs );
	if ( hid_exit() != 0 )
	{
		fprintf( stderr, "Error shutting down the HID API.\n" );
	}
	return 0;
}
<commit_msg>Modified the enumerate program to use the new tempered library. This removes some of its capabilities, such as listing all USB devices and some of the information on them, and refocuses on just listing the devices that the library finds and can use, with the information it provides.<commit_after>#include <stdio.h>

#include "tempered.h"

void print_error( void )
{
	fprintf( stderr, "%s\n", tempered_error() );
}

int main( int argc, char **argv )
{
	if ( !tempered_init() )
	{
		print_error();
		return 1;
	}
	
	struct tempered_device_list *list = tempered_enumerate();
	if ( list == NULL )
	{
		print_error();
	}
	else
	{
		struct tempered_device_list *dev;
		for ( dev = list ; dev != NULL ; dev = dev->next )
		{
			printf(
				"Found device: %04x:%04x %i | %s | %s\n",
				dev->type->vendor_id, dev->type->product_id,
				dev->type->interface_number,
				dev->path,
				dev->type->name
			);
		}
		
		tempered_free_device_list( list );
	}
	
	if ( !tempered_exit() )
	{
		print_error();
		return 1;
	}
	return 0;
}

{'fraction_non_alphanumeric': 0.15557190143435087, 'fraction_numerical': 0.008091210003677823, 'mean_word_length': 2.7006802721088436, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 36, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2581236', 'n_tokens_mistral': 1218, 'n_tokens_neox': 1026, 'n_words': 273}