Removed msc_vid, msc_pid, msc_rev
Because it had no affect anyway. There's only one VID and PID used anyway.
This commit is contained in:
parent
92c4089d6d
commit
5a7ddd5845
|
@ -30,8 +30,7 @@ void setup() {
|
|||
// Load setting and set USB Device IDs
|
||||
preferences::reset();
|
||||
preferences::load();
|
||||
hid::setID(preferences::getHidVid(), preferences::getHidPid(), preferences::getHidRev());
|
||||
msc::setID(preferences::getMscVid().c_str(), preferences::getMscPid().c_str(), preferences::getMscRev().c_str());
|
||||
hid::setID(preferences::getVID(), preferences::getPID(), preferences::getVersion());
|
||||
|
||||
// Read mode from selector switch
|
||||
selector::init();
|
||||
|
|
27
schema.json
27
schema.json
|
@ -61,9 +61,9 @@
|
|||
"title": "Enable HID in setup mode",
|
||||
"default": true
|
||||
},
|
||||
"hid_vid": {
|
||||
"vid": {
|
||||
"type": "string",
|
||||
"title": "USB Keyboard Vendor ID",
|
||||
"title": "USB Vendor ID",
|
||||
"pattern": "^[0-9A-F]{4}$",
|
||||
"default": "16D0",
|
||||
"examples": [
|
||||
|
@ -72,9 +72,9 @@
|
|||
"minLength": 4,
|
||||
"maxLength": 4
|
||||
},
|
||||
"hid_pid": {
|
||||
"pid": {
|
||||
"type": "string",
|
||||
"title": "USB Keyboard Product ID",
|
||||
"title": "USB Product ID",
|
||||
"pattern": "^[0-9A-F]{4}$",
|
||||
"default": "11A4",
|
||||
"examples": [
|
||||
|
@ -83,28 +83,13 @@
|
|||
"minLength": 4,
|
||||
"maxLength": 4
|
||||
},
|
||||
"hid_rev": {
|
||||
"rev": {
|
||||
"type": "string",
|
||||
"title": "USB Keyboard Product Revision",
|
||||
"title": "USB Product Revision (0100 => 1.0)",
|
||||
"default": "0100",
|
||||
"minLength": 4,
|
||||
"maxLength": 4
|
||||
},
|
||||
"msc_vid": {
|
||||
"type": "string",
|
||||
"title": "USB Mass Storage Vendor ID",
|
||||
"default": "SpHuhn"
|
||||
},
|
||||
"msc_pid": {
|
||||
"type": "string",
|
||||
"title": "USB Mass Storage Product ID",
|
||||
"default": "USB Nova"
|
||||
},
|
||||
"msc_rev": {
|
||||
"type": "string",
|
||||
"title": "USB Mass Storage Product Revision",
|
||||
"default": "1.0"
|
||||
},
|
||||
"default_layout": {
|
||||
"type": "string",
|
||||
"title": "Default Keyboard Layout",
|
||||
|
|
|
@ -124,10 +124,6 @@ namespace msc {
|
|||
}
|
||||
}
|
||||
|
||||
void setID(const char* vid, const char* pid, const char* rev) {
|
||||
usb_msc.setID(vid, pid, rev); // Max. 8, 16, 4 characters
|
||||
}
|
||||
|
||||
void enableDrive() {
|
||||
usb_msc.setReadWriteCallback(read_cb, write_cb, flush_cb);
|
||||
usb_msc.setCapacity(flash.size() / 512, 512);
|
||||
|
|
|
@ -9,7 +9,6 @@ namespace msc {
|
|||
bool format(const char* drive_name = "USB Nova");
|
||||
void print();
|
||||
|
||||
void setID(const char* vid, const char* pid, const char* rev);
|
||||
void enableDrive();
|
||||
|
||||
bool changed();
|
||||
|
|
|
@ -25,13 +25,9 @@ namespace preferences {
|
|||
bool enable_led;
|
||||
bool enable_hid;
|
||||
|
||||
std::string hid_vid;
|
||||
std::string hid_pid;
|
||||
std::string hid_rev;
|
||||
|
||||
std::string msc_vid; // max. 8 chars
|
||||
std::string msc_pid; // max. 16 chars
|
||||
std::string msc_rev; // max. 4 chars
|
||||
std::string vid;
|
||||
std::string pid;
|
||||
std::string version;
|
||||
|
||||
std::string default_layout;
|
||||
int default_delay;
|
||||
|
@ -53,6 +49,7 @@ namespace preferences {
|
|||
// Array help functions
|
||||
void add_array(JsonDocument& doc, const char* name, int* array, int size) {
|
||||
JsonArray jarr = doc.createNestedArray(name);
|
||||
|
||||
for (size_t i = 0; i < size; ++i) {
|
||||
jarr.add(array[i]);
|
||||
}
|
||||
|
@ -65,13 +62,9 @@ namespace preferences {
|
|||
root["enable_led"] = enable_led;
|
||||
root["enable_hid"] = enable_hid;
|
||||
|
||||
root["hid_vid"] = hid_vid;
|
||||
root["hid_pid"] = hid_pid;
|
||||
root["hid_rev"] = hid_rev;
|
||||
|
||||
root["msc_vid"] = msc_vid;
|
||||
root["msc_pid"] = msc_pid;
|
||||
root["msc_rev"] = msc_rev;
|
||||
root["vid"] = vid;
|
||||
root["pid"] = pid;
|
||||
root["version"] = version;
|
||||
|
||||
root["default_layout"] = default_layout;
|
||||
root["default_delay"] = default_delay;
|
||||
|
@ -90,6 +83,7 @@ namespace preferences {
|
|||
|
||||
void read_array(JsonDocument& doc, const char* name, int* array, int size) {
|
||||
JsonVariant val = doc[name];
|
||||
|
||||
if (val.isNull()) return;
|
||||
|
||||
JsonArray jarr = val.as<JsonArray>();
|
||||
|
@ -102,6 +96,7 @@ namespace preferences {
|
|||
template<typename T>
|
||||
void read_item(JsonDocument& doc, const char* name, T& val) {
|
||||
JsonVariant new_val = doc[name];
|
||||
|
||||
if (new_val.isNull()) return;
|
||||
val = new_val.as<T>();
|
||||
}
|
||||
|
@ -134,13 +129,9 @@ namespace preferences {
|
|||
read_item<bool>(config_doc, "enable_led", enable_led);
|
||||
read_item<bool>(config_doc, "enable_hid", enable_hid);
|
||||
|
||||
read_item<std::string>(config_doc, "hid_vid", hid_vid);
|
||||
read_item<std::string>(config_doc, "hid_pid", hid_pid);
|
||||
read_item<std::string>(config_doc, "hid_rev", hid_rev);
|
||||
|
||||
read_item<std::string>(config_doc, "msc_vid", msc_vid);
|
||||
read_item<std::string>(config_doc, "msc_pid", msc_pid);
|
||||
read_item<std::string>(config_doc, "msc_rev", msc_rev);
|
||||
read_item<std::string>(config_doc, "vid", vid);
|
||||
read_item<std::string>(config_doc, "pid", pid);
|
||||
read_item<std::string>(config_doc, "version", version);
|
||||
|
||||
read_item<std::string>(config_doc, "default_layout", default_layout);
|
||||
read_item<int>(config_doc, "default_delay", default_delay);
|
||||
|
@ -189,13 +180,9 @@ namespace preferences {
|
|||
enable_led = true;
|
||||
enable_hid = true;
|
||||
|
||||
hid_vid = "16D0";
|
||||
hid_pid = "11A4";
|
||||
hid_rev = "0100";
|
||||
|
||||
msc_vid = "SpHuhn"; // max. 8 chars
|
||||
msc_pid = "USB Nova"; // max. 16 chars
|
||||
msc_rev = "1.0"; // max. 4 chars
|
||||
vid = "16D0";
|
||||
pid = "11A4";
|
||||
version = "0100";
|
||||
|
||||
default_layout = "US";
|
||||
default_delay = 5;
|
||||
|
@ -255,28 +242,16 @@ namespace preferences {
|
|||
return enable_hid;
|
||||
}
|
||||
|
||||
uint16_t getHidVid() {
|
||||
return std::stoi(hid_vid, nullptr, 16);
|
||||
uint16_t getVID() {
|
||||
return std::stoi(vid, nullptr, 16);
|
||||
}
|
||||
|
||||
uint16_t getHidPid() {
|
||||
return std::stoi(hid_pid, nullptr, 16);
|
||||
uint16_t getPID() {
|
||||
return std::stoi(pid, nullptr, 16);
|
||||
}
|
||||
|
||||
uint16_t getHidRev() {
|
||||
return std::stoi(hid_rev, nullptr, 16);
|
||||
}
|
||||
|
||||
std::string getMscVid() {
|
||||
return msc_vid;
|
||||
}
|
||||
|
||||
std::string getMscPid() {
|
||||
return msc_pid;
|
||||
}
|
||||
|
||||
std::string getMscRev() {
|
||||
return msc_rev;
|
||||
uint16_t getVersion() {
|
||||
return std::stoi(version, nullptr, 16);
|
||||
}
|
||||
|
||||
std::string getDefaultLayout() {
|
||||
|
|
|
@ -14,13 +14,9 @@ namespace preferences {
|
|||
bool ledEnabled();
|
||||
bool hidEnabled();
|
||||
|
||||
uint16_t getHidVid();
|
||||
uint16_t getHidPid();
|
||||
uint16_t getHidRev();
|
||||
|
||||
std::string getMscVid();
|
||||
std::string getMscPid();
|
||||
std::string getMscRev();
|
||||
uint16_t getVID();
|
||||
uint16_t getPID();
|
||||
uint16_t getVersion();
|
||||
|
||||
std::string getDefaultLayout();
|
||||
int getDefaultDelay();
|
||||
|
|
Loading…
Reference in New Issue