init: Generalize impl of quirk constructor
This commit is contained in:
parent
464f41137a
commit
297b1c2313
|
@ -11,6 +11,11 @@
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
// Default constructor to add self to the loaded list of quirks
|
||||||
|
DeviceQuirk::DeviceQuirk() {
|
||||||
|
Quirks::Add(this);
|
||||||
|
}
|
||||||
|
|
||||||
// Default destructor for DeviceQuirk
|
// Default destructor for DeviceQuirk
|
||||||
DeviceQuirk::~DeviceQuirk() {
|
DeviceQuirk::~DeviceQuirk() {
|
||||||
|
|
||||||
|
|
|
@ -22,8 +22,9 @@ void fork_execl(Args... args) {
|
||||||
|
|
||||||
class DeviceQuirk {
|
class DeviceQuirk {
|
||||||
public:
|
public:
|
||||||
virtual bool ShouldRun();
|
DeviceQuirk();
|
||||||
virtual void Run();
|
virtual bool ShouldRun() = 0;
|
||||||
|
virtual void Run() = 0;
|
||||||
virtual ~DeviceQuirk();
|
virtual ~DeviceQuirk();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -13,10 +13,6 @@ const string PATHS[] = {
|
||||||
|
|
||||||
class MtkRilQuirk : DeviceQuirk {
|
class MtkRilQuirk : DeviceQuirk {
|
||||||
public:
|
public:
|
||||||
MtkRilQuirk() {
|
|
||||||
Quirks::Add(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ShouldRun() {
|
bool ShouldRun() {
|
||||||
for (auto& p : PATHS) {
|
for (auto& p : PATHS) {
|
||||||
if (filesystem::exists(p)) {
|
if (filesystem::exists(p)) {
|
||||||
|
|
Loading…
Reference in a new issue