steelseries: Rename FuSteelseriesDevice to FuSteelseriesMouse

Also, convert it to a FINAL class.
This commit is contained in:
Richard Hughes 2022-05-21 11:01:14 +01:00
parent 12279b5165
commit 7eb053e97a
6 changed files with 27 additions and 31 deletions

View File

@ -8,15 +8,15 @@
#include <fwupdplugin.h>
#include "fu-steelseries-device.h"
#include "fu-steelseries-fizz.h"
#include "fu-steelseries-gamepad.h"
#include "fu-steelseries-mouse.h"
#include "fu-steelseries-sonic.h"
static void
fu_plugin_steelseries_init(FuPlugin *plugin)
{
fu_plugin_add_device_gtype(plugin, FU_TYPE_STEELSERIES_DEVICE);
fu_plugin_add_device_gtype(plugin, FU_TYPE_STEELSERIES_MOUSE);
fu_plugin_add_device_gtype(plugin, FU_TYPE_STEELSERIES_FIZZ);
fu_plugin_add_device_gtype(plugin, FU_TYPE_STEELSERIES_GAMEPAD);
fu_plugin_add_device_gtype(plugin, FU_TYPE_STEELSERIES_SONIC);

View File

@ -1,20 +0,0 @@
/*
* Copyright (C) 2016 Richard Hughes <richard@hughsie.com>
*
* SPDX-License-Identifier: LGPL-2.1+
*/
#pragma once
#include <fwupdplugin.h>
#define FU_TYPE_STEELSERIES_DEVICE (fu_steelseries_device_get_type())
G_DECLARE_DERIVABLE_TYPE(FuSteelseriesDevice,
fu_steelseries_device,
FU,
STEELSERIES_DEVICE,
FuUsbDevice)
struct _FuSteelseriesDeviceClass {
FuUsbDeviceClass parent_class;
};

View File

@ -8,14 +8,18 @@
#include <string.h>
#include "fu-steelseries-device.h"
#include "fu-steelseries-mouse.h"
#define STEELSERIES_TRANSACTION_TIMEOUT 1000 /* ms */
G_DEFINE_TYPE(FuSteelseriesDevice, fu_steelseries_device, FU_TYPE_USB_DEVICE)
struct _FuSteelseriesMouse {
FuUsbDevice parent_instance;
};
G_DEFINE_TYPE(FuSteelseriesMouse, fu_steelseries_mouse, FU_TYPE_USB_DEVICE)
static gboolean
fu_steelseries_device_setup(FuDevice *device, GError **error)
fu_steelseries_mouse_setup(FuDevice *device, GError **error)
{
GUsbDevice *usb_device = fu_usb_device_get_dev(FU_USB_DEVICE(device));
gboolean ret;
@ -24,7 +28,7 @@ fu_steelseries_device_setup(FuDevice *device, GError **error)
g_autofree gchar *version = NULL;
/* FuUsbDevice->setup */
if (!FU_DEVICE_CLASS(fu_steelseries_device_parent_class)->setup(device, error))
if (!FU_DEVICE_CLASS(fu_steelseries_mouse_parent_class)->setup(device, error))
return FALSE;
memset(data, 0x00, sizeof(data));
@ -82,15 +86,15 @@ fu_steelseries_device_setup(FuDevice *device, GError **error)
}
static void
fu_steelseries_device_init(FuSteelseriesDevice *self)
fu_steelseries_mouse_init(FuSteelseriesMouse *self)
{
fu_device_set_version_format(FU_DEVICE(self), FWUPD_VERSION_FORMAT_TRIPLET);
fu_usb_device_add_interface(FU_USB_DEVICE(self), 0x00);
}
static void
fu_steelseries_device_class_init(FuSteelseriesDeviceClass *klass)
fu_steelseries_mouse_class_init(FuSteelseriesMouseClass *klass)
{
FuDeviceClass *klass_device = FU_DEVICE_CLASS(klass);
klass_device->setup = fu_steelseries_device_setup;
klass_device->setup = fu_steelseries_mouse_setup;
}

View File

@ -0,0 +1,12 @@
/*
* Copyright (C) 2016 Richard Hughes <richard@hughsie.com>
*
* SPDX-License-Identifier: LGPL-2.1+
*/
#pragma once
#include <fwupdplugin.h>
#define FU_TYPE_STEELSERIES_MOUSE (fu_steelseries_mouse_get_type())
G_DECLARE_FINAL_TYPE(FuSteelseriesMouse, fu_steelseries_mouse, FU, STEELSERIES_MOUSE, FuUsbDevice)

View File

@ -10,7 +10,7 @@ shared_module('fu_plugin_steelseries',
sources : [
'fu-plugin-steelseries.c',
'fu-steelseries-common.c',
'fu-steelseries-device.c',
'fu-steelseries-mouse.c',
'fu-steelseries-firmware.c',
'fu-steelseries-fizz.c',
'fu-steelseries-gamepad.c',

View File

@ -1,7 +1,7 @@
# Rival 100
[USB\VID_1038&PID_1702]
Plugin = steelseries
GType = FuSteelseriesDevice
GType = FuSteelseriesMouse
Summary = An optical gaming mouse
Icon = input-mouse