<cahute/detection.h> – Device detection for Cahute

This header declares device detection related utilities for Cahute.

Type definitions

struct cahute_serial_detection_entry

Available serial port that can be opened using cahute_open_serial_link().

char const *cahute_serial_detection_entry_name

Null-terminated name or path of the serial port.

struct cahute_usb_detection_entry

Available USB device that can be opened using cahute_open_usb_link().

int cahute_usb_detection_entry_bus

USB bus number of the entry.

int cahute_usb_detection_entry_address

USB address number of the entry.

int cahute_usb_detection_entry_type

Entry type, amongst the following:

CAHUTE_USB_DETECTION_ENTRY_TYPE_SERIAL

The device is either an fx-9860G, a Classpad 300 / 330 (+), or compatible calculator, using an application over bulk transfers.

Note that the fx-CG calculators sometimes use identify as a serial calculator for OS updating or some types of screenstreaming.

CAHUTE_USB_DETECTION_ENTRY_TYPE_SCSI

The device is a USB Mass Storage device with proprietary extensions to communicate using Protocol 7.00 or Protocol 7.00 Screenstreaming.

See USB detection for CASIO calculators for more information.

typedef int (*cahute_detect_serial_entry_func)(void *cookie, cahute_serial_detection_entry const *entry)

Function that can be called back with a serial detection entry. See cahute_detect_serial() for more information.

typedef int (*cahute_detect_usb_entry_func)(void *cookie, cahute_usb_detection_entry const *entry)

Function that can be called back with a USB detection entry. See cahute_detect_usb() for more information.

Function declarations

int cahute_detect_serial(cahute_detect_serial_entry_func *func, void *cookie)

Detect available serial devices.

For every found entry, the provided function is called with its cookie and details regarding the serial entry, represented by its entry parameter of cahute_serial_detection_entry type.

If the callback returns a non-zero value, it signals the current function to stop and return the CAHUTE_ERROR_INT error.

Parameters:
  • func – Function to call with every entry.

  • cookie – Cookie to pass to the function.

Returns:

The error, or 0 if the operation was successful.

int cahute_detect_usb(cahute_detect_usb_entry_func *func, void *cookie)

Detect available USB devices.

For every found entry, the provided function is called with its cookie and details regarding the USB entry, represented by its entry parameter of cahute_usb_detection_entry type.

If the callback returns a non-zero value, it signals the current function to stop and return the CAHUTE_ERROR_INT error.

Parameters:
  • func – Function to call with every entry.

  • cookie – Cookie to pass to the function.

Returns:

The error, or 0 if the operation was successful.