Commit 43b53583 authored by martin hou's avatar martin hou

feat: 增加对新的PID的兼容识别

parent 912ed191
...@@ -124,6 +124,20 @@ function Jensen(log, conn) { ...@@ -124,6 +124,20 @@ function Jensen(log, conn) {
self.versionNumber = null; self.versionNumber = null;
}; };
function determineModel(productId) {
if (productId == 0xb00c) return 'hidock-h1';
if (productId == 0xb00d) return 'hidock-h1e';
if (productId == 0xb00e) return 'hidock-p1';
if (productId == 0xb00f) return 'hidock-p1:mini';
if (productId == 0x0100) return 'hidock-h1';
if (productId == 0x0101) return 'hidock-h1e';
if (productId == 0x0102) return 'hidock-h1';
if (productId == 0x0103) return 'hidock-h1e';
if (productId == 0x2040) return 'hidock-p1';
if (productId == 0x2041) return 'hidock-p1:mini';
return 'unknown';
}
const setup = async function (disableOnConnect) { const setup = async function (disableOnConnect) {
if (ready) return; if (ready) return;
self.versionCode = null; self.versionCode = null;
...@@ -134,10 +148,7 @@ function Jensen(log, conn) { ...@@ -134,10 +148,7 @@ function Jensen(log, conn) {
await device.claimInterface(0); await device.claimInterface(0);
await device.selectAlternateInterface(0, 0); await device.selectAlternateInterface(0, 0);
pid = device.productId; pid = device.productId;
self.model = device.productId == 0xb00c ? 'hidock-h1' self.model = determineModel(device.productId);
: device.productId == 0xb00d ? 'hidock-h1e'
: device.productId == 0xb00e ? 'hidock-p1'
: device.productId == 0xb00f ? 'hidock-p1:mini' : 'unknown';
Logger.info('jensen', 'connect', 'device pid: ' + device.productId); Logger.info('jensen', 'connect', 'device pid: ' + device.productId);
} catch (e) { } catch (e) {
Logger.error('jensen', 'setup', String(e)); Logger.error('jensen', 'setup', String(e));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment