mirror of
https://git.proxmox.com/git/fwupd
synced 2025-05-08 20:41:41 +00:00

This is a large commit that removes all the providers and turns them into plugins. I think having both providers _and_ plugins was super confusing. Plugins are loaded at runtime so you could in theory develop a new plugin without putting it in the fwupd source tree, although there are no installed headers or PC files as I'm not sure it's a good idea at this stage. This commit moves all the per-provider docs, tests, notes, debug dumps and test data to plugin-specific directories -- these also allows the plugin author to "own" more of the source tree so we don't enforce fu- prefixes and the style guide everywhere. This allows us to run the same action on all the plugins in the future, so we could have a prepare(FuPlugin, FuDevice) and cleanup(FuPlugin, FuDevice) run on *all* plugins, so doing an update using one plugin would allow us to work around hardware quirks in other plugins. If I've broken your out-of-tree provider it's trivial to port to the new API with sed and a fixed up build file. If you need help please let me know.
93 lines
3.6 KiB
C
93 lines
3.6 KiB
C
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
|
|
*
|
|
* Copyright (C) 2016 Richard Hughes <richard@hughsie.com>
|
|
*
|
|
* Licensed under the GNU General Public License Version 2
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
*/
|
|
|
|
#ifndef __FU_EBITDO_COMMON_H
|
|
#define __FU_EBITDO_COMMON_H
|
|
|
|
#include <glib.h>
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
/* little endian */
|
|
typedef struct __attribute__((packed)) {
|
|
guint32 version;
|
|
guint32 destination_addr;
|
|
guint32 destination_len;
|
|
guint32 reserved[4];
|
|
} FuEbitdoFirmwareHeader;
|
|
|
|
/* little endian */
|
|
typedef struct __attribute__((packed)) {
|
|
guint8 pkt_len;
|
|
guint8 type; /* FuEbitdoPktType */
|
|
guint8 subtype; /* FuEbitdoPktCmd */
|
|
guint16 cmd_len;
|
|
guint8 cmd; /* FuEbitdoPktCmd */
|
|
guint16 payload_len; /* optional */
|
|
} FuEbitdoPkt;
|
|
|
|
#define FU_EBITDO_USB_TIMEOUT 5000 /* ms */
|
|
#define FU_EBITDO_USB_BOOTLOADER_EP_IN 0x82
|
|
#define FU_EBITDO_USB_BOOTLOADER_EP_OUT 0x01
|
|
#define FU_EBITDO_USB_RUNTIME_EP_IN 0x81
|
|
#define FU_EBITDO_USB_RUNTIME_EP_OUT 0x02
|
|
#define FU_EBITDO_USB_EP_SIZE 64 /* bytes */
|
|
|
|
typedef enum {
|
|
FU_EBITDO_PKT_TYPE_USER_CMD = 0x00,
|
|
FU_EBITDO_PKT_TYPE_USER_DATA = 0x01,
|
|
FU_EBITDO_PKT_TYPE_MID_CMD = 0x02,
|
|
FU_EBITDO_PKT_TYPE_LAST
|
|
} FuEbitdoPktType;
|
|
|
|
/* commands */
|
|
typedef enum {
|
|
FU_EBITDO_PKT_CMD_FW_UPDATE_DATA = 0x00, /* update firmware data */
|
|
FU_EBITDO_PKT_CMD_FW_UPDATE_HEADER = 0x01, /* update firmware header */
|
|
FU_EBITDO_PKT_CMD_FW_UPDATE_OK = 0x02, /* mark update as successful */
|
|
FU_EBITDO_PKT_CMD_FW_UPDATE_ERROR = 0x03, /* update firmware error */
|
|
FU_EBITDO_PKT_CMD_FW_GET_VERSION = 0x04, /* get cur firmware vision */
|
|
FU_EBITDO_PKT_CMD_FW_SET_VERSION = 0x05, /* set firmware version */
|
|
FU_EBITDO_PKT_CMD_FW_SET_ENCODE_ID = 0x06, /* set app firmware encode ID */
|
|
FU_EBITDO_PKT_CMD_ACK = 0x14, /* acknowledge */
|
|
FU_EBITDO_PKT_CMD_NAK = 0x15, /* negative acknowledge */
|
|
FU_EBITDO_PKT_CMD_UPDATE_FIRMWARE_DATA = 0x16, /* update firmware data */
|
|
FU_EBITDO_PKT_CMD_TRANSFER_ABORT = 0x18, /* aborts transfer */
|
|
FU_EBITDO_PKT_CMD_VERIFICATION_ID = 0x19, /* verification id (only BT?) */
|
|
FU_EBITDO_PKT_CMD_GET_VERIFICATION_ID = 0x1a, /* verification id (only BT) */
|
|
FU_EBITDO_PKT_CMD_VERIFY_ERROR = 0x1b, /* verification error */
|
|
FU_EBITDO_PKT_CMD_VERIFY_OK = 0x1c, /* verification successful */
|
|
FU_EBITDO_PKT_CMD_TRANSFER_TIMEOUT = 0x1d, /* send or recieve data timeout */
|
|
FU_EBITDO_PKT_CMD_GET_VERSION = 0x21, /* get fw ver, joystick mode */
|
|
FU_EBITDO_PKT_CMD_GET_VERSION_RESPONSE = 0x22, /* get fw version response */
|
|
FU_EBITDO_PKT_CMD_FW_LAST
|
|
} FuEbitdoPktCmd;
|
|
|
|
const gchar *fu_ebitdo_pkt_cmd_to_string (FuEbitdoPktCmd cmd);
|
|
const gchar *fu_ebitdo_pkt_type_to_string (FuEbitdoPktType type);
|
|
void fu_ebitdo_dump_firmware_header (FuEbitdoFirmwareHeader *hdr);
|
|
void fu_ebitdo_dump_pkt (FuEbitdoPkt *hdr);
|
|
void fu_ebitdo_dump_raw (const gchar *title,
|
|
const guint8 *data,
|
|
gsize len);
|
|
|
|
#endif /* __FU_EBITDO_COMMON_H */
|