/*
 * SPDX-FileCopyrightText: 2023 CERN (home.cern)
 *
 * SPDX-License-Identifier: LGPL-2.1-or-later
 */

/**
 * @file usb-enum.h
 * @brief OASIS USB Attenuator driver library interface
 *
 * This file describes the external interface to the OASIS USB Attenuator
 * driver and provides the definitions for proper communication
 * with the device
 *
 * @author David Cobas <dcobas AT cern.ch>
 */

/**
 *  \brief oattnusb_usb_dev - representation of an oattn device in all
 *  concevable forms
 */
struct oattnusb_usb_dev {
	int	lun;		/**< logical unit number (not implemented) */
	char	busnum[6];	/**< USB bus number (decimal) */
	char	devnum[6];	/**< USB dev number (decimal) */
	char	portnum[6];	/**< USB port number (decimal) */
	char	busport[16];	/**< USB bus-port string (decimal bbb-ppp) */
	char	devno[10];	/**< Linux kernel devno (decimal major:minor) */
	char	serial[48];	/**< Serial number (e.g.  HCCAIAD000-CR000003) */
	char	path[256];	/**< Linux sysfs device path */
	int	unused[4];
};

/**
 *  \struct oattnusb_devarray
 *  \brief  array of oattn devices detected in the system
 */
struct oattnusb_devarray {
	int			ndevs;	/**< number of devices (i.e.  array length) */
	struct oattnusb_usb_dev	*devs;  /**< pointer to array of devices */
};

/** oattnusb_display_devarray - auxiliary function to display the
 *   detected device array table
 */
void oattnusb_display_devarray(struct oattnusb_devarray *ls);

/** oattnusb_get_devarray - populate library's static table of detected devices
 */
struct oattnusb_devarray *oattnusb_get_devarray(unsigned int vendor_id, unsigned int device_id);
