USB

Description

Mini-EUSO will store data on USB flash drives which will be sent to Earth periodically during its mission. USB storage will also be used to pass configuration files to Mini-EUSO and quick-look diagnostic data back to Earth via the ISS internet connection.

UsbManager makes use of the libusb package to identify USB devices and handle automated data backups using rsync whenever the instrument is switched on.

UsbManager

class UsbManager

handles the interface to all USB devices, including data storage and automated backup

Public Functions

UsbManager()

constructor. initilaises num_storage_dev as N_USB_UNDEF

uint8_t LookupUsbStorage()

lookup usb storage devices connected and identify them designed to avoid detecting the cameras and other devices as storage

int RunDataBackup()

spawn thread to run data backup in the background

int KillDataBackup()

kill the data backup thread, used when shutting down the data backup thread holds no locked resources

Public Members

uint8_t storage_bus

defines the bus upon which USB storage is present depends on the CPU module

uint8_t num_storage_dev

stores the number of storage devices connected

bool backup_launched

stores true if a data backup is running

Public Static Functions

static int CheckUsb()

check the number of devices connected and print their info

Private Functions

void CheckCpuModel()

check cpu model to select correct storage_bus

int DataBackup()

define data backup based on num_storage_dev

int GetDeviceInterface(libusb_device *dev)

returns an int which represents the usb device interface (see libusb_class_code)

Parameters:

the – libusb device descriptor

Private Members

std::thread::native_handle_type backup_thread_handle

stores the backup thread handle

Private Static Functions

static void PrintDev(libusb_device *dev)

print a description of usb devices connected for debugging purposes

Parameters:

dev – the libusb device handle