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

This header declares device detection related utilities for Cahute.

Macro definitions

CAHUTE_USB_DETECTION_ENTRY_TYPE_* are constants representing the type of device identified using the USB descriptor.

CAHUTE_USB_DETECTION_ENTRY_TYPE_SEVEN

The device is an fx-9860G or compatible calculator, using Protocol 7.00 directly through bulk transfers.

Note that the fx-CG calculators sometimes use identify as an fx-9860G for os updating or some types of screenstreaming.

CAHUTE_USB_DETECTION_ENTRY_TYPE_SCSI

The device is an fx-CG or compatible calculator, using SCSI with extensions to communicate using Protocol 7.00 through vendor-specific commands.

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_SEVEN

The device is a Protocol 7.00 device over bulk.

See Protocol 7.00 – Serial and USB protocol used by post fx-9860G calculators for more details.

CAHUTE_USB_DETECTION_ENTRY_TYPE_SCSI

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

See USB Mass Storage (UMS) and proprietary extensions for fx-CG calculators for more details.

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.