<commit_before>#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>

#include "initialize.h"
#include "accessory.h"
#include "usb.h"
#include "config.h"

int readAccessory(AapConnection* con, void* buffer, int size_max)
{
	return con->readAccessory(con, buffer, size_max);
}

int readAllAccessory(AapConnection* con, void* buffer, int size)
{
	int response = 0;
	while(size > 0 && response >= 0)
	{
		response = readAccessory(con, buffer, size);
		size -= response;
		buffer += response;
	}
	return response < 0 ? response : 0;
}

int writeAccessory(AapConnection* con, const void* buffer, int size_max)
{
	return con->writeAccessory(con, buffer, size_max);
}

int writeAllAccessory(AapConnection* con, const void* buffer, int size)
{
	int response = 0;
	while(size > 1 && response >= 0)
	{
		response = writeAccessory(con, buffer, size);
		size -= response;
		buffer += response;
	}
	return response < 0 ? response : 0;
}

Accessory* initAccessory(
		const char* manufacturer,
		const char* modelName,
		const char* description,
		const char* const* bt_uuids,
		const char* version,
		const char* uri,
		const char* serialNumber)
{
 	libusb_context *usb_context;
 	if (libusb_init(&usb_context))
 	{
 		fprintf(stderr,"libAndroidAccessory: Failed to init libusb-1.0\n");
 		return NULL;
 	}

#ifdef DEBUG
 	libusb_set_debug(usb_context,3);
#else
 	libusb_set_debug(usb_context,2);
#endif

 	struct udev *udev = udev_new();<commit_msg>Bugfix: #7 Android: Bulk transfer, one byte test fails<commit_after>#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>

#include "initialize.h"
#include "accessory.h"
#include "usb.h"
#include "config.h"

int readAccessory(AapConnection* con, void* buffer, int size_max)
{
	return con->readAccessory(con, buffer, size_max);
}

int readAllAccessory(AapConnection* con, void* buffer, int size)
{
	int response = 0;
	while(size > 0 && response >= 0)
	{
		response = readAccessory(con, buffer, size);
		size -= response;
		buffer += response;
	}
	return response < 0 ? response : 0;
}

int writeAccessory(AapConnection* con, const void* buffer, int size_max)
{
	return con->writeAccessory(con, buffer, size_max);
}

int writeAllAccessory(AapConnection* con, const void* buffer, int size)
{
	int response = 0;
	while(size > 0 && response >= 0)
	{
		response = writeAccessory(con, buffer, size);
		size -= response;
		buffer += response;
	}
	return response < 0 ? response : 0;
}

Accessory* initAccessory(
		const char* manufacturer,
		const char* modelName,
		const char* description,
		const char* const* bt_uuids,
		const char* version,
		const char* uri,
		const char* serialNumber)
{
 	libusb_context *usb_context;
 	if (libusb_init(&usb_context))
 	{
 		fprintf(stderr,"libAndroidAccessory: Failed to init libusb-1.0\n");
 		return NULL;
 	}

#ifdef DEBUG
 	libusb_set_debug(usb_context,3);
#else
 	libusb_set_debug(usb_context,2);
#endif

 	struct udev *udev = udev_new();
{'fraction_non_alphanumeric': 0.12966073228081962, 'fraction_numerical': 0.009741350352704065, 'mean_word_length': 4.694072657743786, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 23, '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': '4429041', 'n_tokens_mistral': 1130, 'n_tokens_neox': 1058, 'n_words': 285}