7 Commits

Author SHA1 Message Date
László Monda
d3295c5666 Bump package.json and changelog to version 1.0.4 2017-12-30 15:29:02 +01:00
László Monda
216793bbb8 Add get-{left,right}-firmware-version.js 2017-12-29 13:34:49 +01:00
László Monda
558c8b0dbf Merge branch 'master' of github.com:UltimateHackingKeyboard/agent 2017-12-29 13:24:26 +01:00
László Monda
e3c65f77df Rename getProperty to getDeviceProperty and getModuleProperties to getModuleProperty. 2017-12-29 13:23:58 +01:00
László Monda
227f8f0d2c Update package-lock.json files. 2017-12-29 13:23:32 +01:00
Mikko Lakomaa
7e0bc39de1 Mouse speed UI (#537)
* Add SliderProps interface to SliderWrapperComponent

* Implement mouse speed page

* Remove duplicate DefaultUserConfigurationService from shared module

* Add Reset speeds to default button

* Move reset button to bottom of mouse speed page

* Change mouse move slider step to 25

* Add label and tooltip handling to SliderWrapperComponent

* Use altered SliderWrapperComponent in mouse speed page

* Use altered SliderWrapperComponent in LED brightness page

* Move Reset mouse speeds confirmation popover to above button

* Add reset mouse speed settings action and effect

* Use ResetMouseSpeedSettingsAction in mouse speed page to reset settings

* Remove unused import
2017-12-29 13:07:01 +01:00
Spencer Owen
c4d3648f73 Invert scroll on mac (#536) 2017-12-28 13:50:11 +01:00
24 changed files with 907 additions and 1868 deletions

View File

@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
The format is loosely based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). The format is loosely based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
## [1.0.4] - 2017-12-30
Firmware: [8.0.0](https://github.com/UltimateHackingKeyboard/firmware/releases/tag/8.0.0) | Device Protocol: 4.0.0 | User Config: 4.0.0 | Hardware Config: 1.0.0
- Add mouse speed settings.
## [1.0.3] - 2017-12-28 ## [1.0.3] - 2017-12-28
Firmware: [8.0.**0**](https://github.com/UltimateHackingKeyboard/firmware/releases/tag/8.0.**0**) | Device Protocol: 4.0.0 | User Config: 4.0.0 | Hardware Config: 1.0.0 Firmware: [8.0.**0**](https://github.com/UltimateHackingKeyboard/firmware/releases/tag/8.0.**0**) | Device Protocol: 4.0.0 | User Config: 4.0.0 | Hardware Config: 1.0.0

2
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{ {
"name": "uhk-agent", "name": "uhk-agent",
"version": "1.0.2", "version": "1.0.3",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@@ -3,7 +3,7 @@
"private": true, "private": true,
"author": "Ultimate Gadget Laboratories", "author": "Ultimate Gadget Laboratories",
"main": "electron/dist/electron-main.js", "main": "electron/dist/electron-main.js",
"version": "1.0.3", "version": "1.0.4",
"description": "Agent is the configuration application of the Ultimate Hacking Keyboard.", "description": "Agent is the configuration application of the Ultimate Hacking Keyboard.",
"repository": { "repository": {
"type": "git", "type": "git",

File diff suppressed because it is too large Load Diff

View File

@@ -4,9 +4,8 @@
</h1> </h1>
<div class="row led-setting"> <div class="row led-setting">
<div class="col-xs-12 col-md-6"> <div class="col-xs-12 col-md-6">
<label>LED display icon and layer texts brightness</label>
<div class="slider-wrapper-container">
<slider-wrapper <slider-wrapper
label="LED display icon and layer texts brightness"
[min]="0" [min]="0"
[max]="255" [max]="255"
[step]="1" [step]="1"
@@ -14,14 +13,11 @@
[(ngModel)]="iconsAndLayerTextsBrightness" [(ngModel)]="iconsAndLayerTextsBrightness"
(ngModelChange)="onSetPropertyValue('iconsAndLayerTextsBrightness', $event)"></slider-wrapper> (ngModelChange)="onSetPropertyValue('iconsAndLayerTextsBrightness', $event)"></slider-wrapper>
</div> </div>
</div>
</div> </div>
<div class="row led-setting"> <div class="row led-setting">
<div class="col-xs-12 col-md-6"> <div class="col-xs-12 col-md-6">
<label>LED display alphanumeric segments brightness</label>
<div class="slider-wrapper-container">
<slider-wrapper <slider-wrapper
label="LED display alphanumeric segments brightness"
[min]="0" [min]="0"
[max]="255" [max]="255"
[step]="1" [step]="1"
@@ -29,13 +25,11 @@
[(ngModel)]="alphanumericSegmentsBrightness" [(ngModel)]="alphanumericSegmentsBrightness"
(ngModelChange)="onSetPropertyValue('alphanumericSegmentsBrightness', $event)"></slider-wrapper> (ngModelChange)="onSetPropertyValue('alphanumericSegmentsBrightness', $event)"></slider-wrapper>
</div> </div>
</div>
</div> </div>
<div class="row led-setting"> <div class="row led-setting">
<div class="col-xs-12 col-md-6"> <div class="col-xs-12 col-md-6">
<label>Key backlight brightness</label>
<div class="slider-wrapper-container">
<slider-wrapper <slider-wrapper
label="Key backlight brightness"
[min]="0" [min]="0"
[max]="255" [max]="255"
[step]="1" [step]="1"
@@ -43,5 +37,4 @@
[(ngModel)]="keyBacklightBrightness" [(ngModel)]="keyBacklightBrightness"
(ngModelChange)="onSetPropertyValue('keyBacklightBrightness', $event)"></slider-wrapper> (ngModelChange)="onSetPropertyValue('keyBacklightBrightness', $event)"></slider-wrapper>
</div> </div>
</div>
</div> </div>

View File

@@ -12,8 +12,4 @@
.led-setting { .led-setting {
margin-bottom: 6rem; margin-bottom: 6rem;
} }
.slider-wrapper-container {
margin-left: 1.6rem;
}
} }

View File

@@ -2,6 +2,41 @@
<i class="fa fa-sliders"></i> <i class="fa fa-sliders"></i>
<span>Mouse speed</span> <span>Mouse speed</span>
</h1> </h1>
<p> <h3>Mouse pointer speed</h3>
Coming soon ... <div class="row mouse-speed-setting" *ngFor="let prop of moveProps">
</p> <div class="col-xs-12 col-md-6">
<slider-wrapper
[label]="prop.title"
[tooltip]="prop.tooltip"
[min]="moveSettings.min"
[max]="moveSettings.max"
[step]="moveSettings.step"
[pips]="sliderPips"
[valueUnit]="prop.valueUnit"
[(ngModel)]="prop.value"
(ngModelChange)="onSetPropertyValue(prop.prop, $event)"></slider-wrapper>
</div>
</div>
<h3>Mouse scroll speed</h3>
<div class="row mouse-speed-setting" *ngFor="let prop of scrollProps">
<div class="col-xs-12 col-md-6">
<slider-wrapper
[label]="prop.title"
[tooltip]="prop.tooltip"
[min]="scrollSettings.min"
[max]="scrollSettings.max"
[step]="scrollSettings.step"
[pips]="sliderPips"
[valueUnit]="prop.valueUnit"
[(ngModel)]="prop.value"
(ngModelChange)="onSetPropertyValue(prop.prop, $event)"></slider-wrapper>
</div>
</div>
<button class="btn btn-danger mouse-speed-reset-button"
mwlConfirmationPopover
title="Are you sure?"
placement="top"
confirmText="Yes"
cancelText="No"
(confirm)="resetToDefault()">Reset speeds to default
</button>

View File

@@ -4,4 +4,25 @@
height: 100%; height: 100%;
width: 100%; width: 100%;
label {
display: block;
font-weight: normal;
icon {
display: inline-block;
}
}
.mouse-speed-reset-button {
display: block;
margin-bottom: 4rem;
}
.mouse-speed-setting {
margin-bottom: 6rem;
+ h3 {
margin-top: 2rem;
}
}
} }

View File

@@ -1,4 +1,14 @@
import { Component } from '@angular/core'; import { Component, OnInit, OnDestroy } from '@angular/core';
import { Store } from '@ngrx/store';
import { AppState, getUserConfiguration } from '../../../store';
import { SetUserConfigurationValueAction } from '../../../store/actions/user-config';
import { DefaultUserConfigurationService } from '../../../services/default-user-configuration.service';
import { SliderPips, SliderProps } from '../../slider-wrapper/slider-wrapper.component';
import { Subscription } from 'rxjs/Subscription';
import { UserConfiguration } from 'uhk-common';
import { ResetMouseSpeedSettingsAction } from '../../../store/actions/device';
const MOUSE_MOVE_VALUE_MULTIPLIER = 25;
@Component({ @Component({
selector: 'device-mouse-speed', selector: 'device-mouse-speed',
@@ -8,5 +18,131 @@ import { Component } from '@angular/core';
'class': 'container-fluid' 'class': 'container-fluid'
} }
}) })
export class MouseSpeedComponent { export class MouseSpeedComponent implements OnInit, OnDestroy {
public moveProps = [
{
prop: 'mouseMoveInitialSpeed',
title: 'Initial speed',
tooltip: 'When mouse movement begins, this is the starting speed.',
valueUnit: 'px/s',
value: 0
},
{
prop: 'mouseMoveBaseSpeed',
title: 'Base speed',
tooltip: 'This speed is reached after the initial moving speed sufficiently ramps up.',
valueUnit: 'px/s',
value: 0
},
{
prop: 'mouseMoveAcceleration',
title: 'Acceleration',
tooltip: 'The rate of acceleration from the initial movement speed to the base speed.',
valueUnit: 'px/s²',
value: 0
},
{
prop: 'mouseMoveDeceleratedSpeed',
title: 'Decelerated speed',
tooltip: 'This speed is used while moving with the <i>decelerate key</i> pressed.',
valueUnit: 'px/s',
value: 0
},
{
prop: 'mouseMoveAcceleratedSpeed',
title: 'Accelerated speed',
tooltip: 'This speed is used while moving with the <i>accelerate key</i> pressed.',
valueUnit: 'px/s',
value: 0
}
];
public scrollProps = [
{
prop: 'mouseScrollInitialSpeed',
title: 'Initial speed',
tooltip: 'When mouse scrolling begins, this is the starting speed.',
valueUnit: 'pulse/s',
value: 0
},
{
prop: 'mouseScrollBaseSpeed',
title: 'Base speed',
tooltip: 'This speed is reached after the initial scrolling speed sufficiently ramps up.',
valueUnit: 'pulse/s',
value: 0
},
{
prop: 'mouseScrollAcceleration',
title: 'Acceleration',
tooltip: 'The rate of acceleration from the initial scrolling speed to the base speed.',
valueUnit: 'pulse/s²',
value: 0
},
{
prop: 'mouseScrollDeceleratedSpeed',
title: 'Decelerated speed',
tooltip: 'This speed is used while scrolling with the <i>decelerate key</i> pressed.',
valueUnit: 'pulse/s',
value: 0
},
{
prop: 'mouseScrollAcceleratedSpeed',
title: 'Accelerated speed',
tooltip: 'This speed is used while scrolling with the <i>accelerate key</i> pressed.',
valueUnit: 'pulse/s',
value: 0
}
];
public sliderPips: SliderPips = {
mode: 'positions',
values: [0, 50, 100],
density: 6,
stepped: true
};
public moveSettings: SliderProps = {
min: MOUSE_MOVE_VALUE_MULTIPLIER,
max: 6375,
step: MOUSE_MOVE_VALUE_MULTIPLIER
};
public scrollSettings: SliderProps = {
min: 1,
max: 255,
step: 1
};
private userConfig$: Store<UserConfiguration>;
private userConfigSubscription: Subscription;
constructor(private store: Store<AppState>, private defaultUserConfigurationService: DefaultUserConfigurationService) {}
ngOnInit(): void {
this.userConfig$ = this.store.select(getUserConfiguration);
this.userConfigSubscription = this.userConfig$.subscribe(config => {
this.moveProps.forEach(moveProp => {
moveProp.value = config[moveProp.prop] * MOUSE_MOVE_VALUE_MULTIPLIER || 0;
});
this.scrollProps.forEach(scrollProp => {
scrollProp.value = config[scrollProp.prop] || 0;
});
});
}
ngOnDestroy(): void {
this.userConfigSubscription.unsubscribe();
}
onSetPropertyValue(propertyName: string, value: number): void {
this.store.dispatch(new SetUserConfigurationValueAction({
propertyName,
value: propertyName.indexOf('mouseMove') !== -1 ? value / MOUSE_MOVE_VALUE_MULTIPLIER : value
}));
}
resetToDefault() {
this.store.dispatch(new ResetMouseSpeedSettingsAction());
}
} }

View File

@@ -1,4 +1,14 @@
<div class="slider-container"> <label *ngIf="label">
<span>{{label}}</span>
<icon name="question-circle"
data-toggle="tooltip"
[title]="tooltip"
html="true"
data-placement="bottom"
*ngIf="tooltip"></icon>
</label>
<div class="slider-wrapper">
<div class="slider-container">
<nouislider <nouislider
[min]="min" [min]="min"
[max]="max" [max]="max"
@@ -7,7 +17,8 @@
[tooltips]="true" [tooltips]="true"
[(ngModel)]="value" [(ngModel)]="value"
(ngModelChange)="onSliderChange($event)"></nouislider> (ngModelChange)="onSliderChange($event)"></nouislider>
</div> </div>
<div class="slider-value"> <div class="slider-value">
<div class="value-indicator">{{value}} {{valueUnit}}</div> <div class="value-indicator">{{value}} {{valueUnit}}</div>
</div>
</div> </div>

View File

@@ -1,6 +1,18 @@
:host { :host {
label {
display: block;
font-weight: normal;
icon {
display: inline-block;
}
}
.slider-wrapper {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
padding-left: 1.6rem;
}
.slider-container { .slider-container {
width: 80%; width: 80%;

View File

@@ -13,6 +13,14 @@ export interface SliderPips {
stepped?: boolean; stepped?: boolean;
} }
export interface SliderProps {
min: number;
max: number;
step?: number;
pips?: SliderPips;
valueUnit?: string;
}
@Component({ @Component({
selector: 'slider-wrapper', selector: 'slider-wrapper',
templateUrl: './slider-wrapper.component.html', templateUrl: './slider-wrapper.component.html',
@@ -23,6 +31,8 @@ export interface SliderPips {
}) })
export class SliderWrapperComponent implements AfterViewInit, ControlValueAccessor, OnDestroy { export class SliderWrapperComponent implements AfterViewInit, ControlValueAccessor, OnDestroy {
@ViewChild(NouisliderComponent) slider: NouisliderComponent; @ViewChild(NouisliderComponent) slider: NouisliderComponent;
@Input() label: string;
@Input() tooltip: string;
@Input() min: number; @Input() min: number;
@Input() max: number; @Input() max: number;
@Input() step: number; @Input() step: number;

View File

@@ -4917,7 +4917,7 @@
null, null,
{ {
"keyActionType": "mouse", "keyActionType": "mouse",
"mouseAction": "scrollUp" "mouseAction": "scrollDown"
}, },
{ {
"keyActionType": "mouse", "keyActionType": "mouse",
@@ -4936,7 +4936,7 @@
null, null,
{ {
"keyActionType": "mouse", "keyActionType": "mouse",
"mouseAction": "scrollDown" "mouseAction": "scrollUp"
}, },
null, null,
null, null,
@@ -5926,7 +5926,7 @@
null, null,
{ {
"keyActionType": "mouse", "keyActionType": "mouse",
"mouseAction": "scrollUp" "mouseAction": "scrollDown"
}, },
{ {
"keyActionType": "mouse", "keyActionType": "mouse",
@@ -5945,7 +5945,7 @@
null, null,
{ {
"keyActionType": "mouse", "keyActionType": "mouse",
"mouseAction": "scrollDown" "mouseAction": "scrollUp"
}, },
null, null,
null, null,
@@ -6927,7 +6927,7 @@
null, null,
{ {
"keyActionType": "mouse", "keyActionType": "mouse",
"mouseAction": "scrollUp" "mouseAction": "scrollDown"
}, },
{ {
"keyActionType": "mouse", "keyActionType": "mouse",
@@ -6946,7 +6946,7 @@
null, null,
{ {
"keyActionType": "mouse", "keyActionType": "mouse",
"mouseAction": "scrollDown" "mouseAction": "scrollUp"
}, },
null, null,
null, null,

View File

@@ -193,7 +193,6 @@ import { SliderWrapperComponent } from './components/slider-wrapper/slider-wrapp
DataStorageRepositoryService, DataStorageRepositoryService,
DefaultUserConfigurationService, DefaultUserConfigurationService,
LogService, LogService,
DefaultUserConfigurationService,
AppUpdateRendererService, AppUpdateRendererService,
AppRendererService, AppRendererService,
IpcCommonRenderer, IpcCommonRenderer,

View File

@@ -16,6 +16,7 @@ export const ActionTypes = {
SAVE_TO_KEYBOARD_FAILED: type(PREFIX + 'save to keyboard failed'), SAVE_TO_KEYBOARD_FAILED: type(PREFIX + 'save to keyboard failed'),
HIDE_SAVE_TO_KEYBOARD_BUTTON: type(PREFIX + 'hide save to keyboard button'), HIDE_SAVE_TO_KEYBOARD_BUTTON: type(PREFIX + 'hide save to keyboard button'),
RESET_USER_CONFIGURATION: type(PREFIX + 'reset user configuration'), RESET_USER_CONFIGURATION: type(PREFIX + 'reset user configuration'),
RESET_MOUSE_SPEED_SETTINGS: type(PREFIX + 'reset mouse speed settings'),
UPDATE_FIRMWARE: type(PREFIX + 'update firmware'), UPDATE_FIRMWARE: type(PREFIX + 'update firmware'),
UPDATE_FIRMWARE_WITH: type(PREFIX + 'update firmware with'), UPDATE_FIRMWARE_WITH: type(PREFIX + 'update firmware with'),
UPDATE_FIRMWARE_REPLY: type(PREFIX + 'update firmware reply'), UPDATE_FIRMWARE_REPLY: type(PREFIX + 'update firmware reply'),
@@ -109,6 +110,10 @@ export class UpdateFirmwareOkButtonAction implements Action {
type = ActionTypes.UPDATE_FIRMWARE_OK_BUTTON; type = ActionTypes.UPDATE_FIRMWARE_OK_BUTTON;
} }
export class ResetMouseSpeedSettingsAction implements Action {
type = ActionTypes.RESET_MOUSE_SPEED_SETTINGS;
}
export type Actions export type Actions
= SetPrivilegeOnLinuxAction = SetPrivilegeOnLinuxAction
| SetPrivilegeOnLinuxReplyAction | SetPrivilegeOnLinuxReplyAction
@@ -119,6 +124,7 @@ export type Actions
| SaveToKeyboardSuccessAction | SaveToKeyboardSuccessAction
| SaveToKeyboardSuccessFailed | SaveToKeyboardSuccessFailed
| HideSaveToKeyboardButton | HideSaveToKeyboardButton
| ResetMouseSpeedSettingsAction
| ResetUserConfigurationAction | ResetUserConfigurationAction
| UpdateFirmwareAction | UpdateFirmwareAction
| UpdateFirmwareWithAction | UpdateFirmwareWithAction

View File

@@ -130,6 +130,30 @@ export class DeviceEffects {
.switchMap(() => Observable.of(new HideSaveToKeyboardButton())) .switchMap(() => Observable.of(new HideSaveToKeyboardButton()))
); );
@Effect()
resetMouseSpeedSettings$: Observable<Action> = this.actions$
.ofType(ActionTypes.RESET_MOUSE_SPEED_SETTINGS)
.switchMap(() => {
const config = this.defaultUserConfigurationService.getDefault();
const mouseSpeedDefaultSettings = {};
const mouseSpeedProps = [
'mouseMoveInitialSpeed',
'mouseMoveAcceleration',
'mouseMoveDeceleratedSpeed',
'mouseMoveBaseSpeed',
'mouseMoveAcceleratedSpeed',
'mouseScrollInitialSpeed',
'mouseScrollAcceleration',
'mouseScrollDeceleratedSpeed',
'mouseScrollBaseSpeed',
'mouseScrollAcceleratedSpeed'
];
mouseSpeedProps.forEach(prop => {
mouseSpeedDefaultSettings[prop] = config[prop];
});
return Observable.of(new LoadResetUserConfigurationAction(<UserConfiguration>mouseSpeedDefaultSettings));
});
@Effect() resetUserConfiguration$: Observable<Action> = this.actions$ @Effect() resetUserConfiguration$: Observable<Action> = this.actions$
.ofType(ActionTypes.RESET_USER_CONFIGURATION) .ofType(ActionTypes.RESET_USER_CONFIGURATION)
.switchMap(() => { .switchMap(() => {

View File

@@ -2,7 +2,7 @@
const uhk = require('./uhk'); const uhk = require('./uhk');
const device = uhk.getUhkDevice(); const device = uhk.getUhkDevice();
const sendData = new Buffer([uhk.usbCommands.getProperty, uhk.devicePropertyIds.configSizes]); const sendData = new Buffer([uhk.usbCommands.getDeviceProperty, uhk.devicePropertyIds.configSizes]);
device.write(uhk.getTransferData(sendData)); device.write(uhk.getTransferData(sendData));
const response = Buffer.from(device.readSync()); const response = Buffer.from(device.readSync());

View File

@@ -0,0 +1,16 @@
#!/usr/bin/env node
const uhk = require('./uhk');
const device = uhk.getUhkDevice();
const sendData = new Buffer([uhk.usbCommands.getModuleProperty, uhk.modulePropertyIds.protocolVersions]);
console.log(sendData)
device.write(uhk.getTransferData(sendData));
const response = Buffer.from(device.readSync());
console.log(response)
const firmwareMajorVersion = response[7] + (response[8]<<8);
const firmwareMinorVersion = response[9] + (response[10]<<8);
const firmwarePatchVersion = response[11] + (response[12]<<8);
console.log(`firmwareMajorVersion: ${firmwareMajorVersion}`);
console.log(`firmwareMinorVersion: ${firmwareMinorVersion}`);
console.log(`firmwarePatchVersion: ${firmwarePatchVersion}`);

View File

@@ -3,7 +3,7 @@ const uhk = require('./uhk');
const device = uhk.getUhkDevice(); const device = uhk.getUhkDevice();
function getModuleState() { function getModuleState() {
const payload = new Buffer([uhk.usbCommands.getModuleProperties, 1]); const payload = new Buffer([uhk.usbCommands.getModuleProperty, 1]);
console.log('Sending ', uhk.bufferToString(payload)); console.log('Sending ', uhk.bufferToString(payload));
device.write(uhk.getTransferData(payload)); device.write(uhk.getTransferData(payload));
const receivedBuffer = device.readSync(); const receivedBuffer = device.readSync();

View File

@@ -0,0 +1,15 @@
#!/usr/bin/env node
const uhk = require('./uhk');
const device = uhk.getUhkDevice();
const sendData = new Buffer([uhk.usbCommands.getDeviceProperty, uhk.devicePropertyIds.protocolVersions]);
device.write(uhk.getTransferData(sendData));
const response = Buffer.from(device.readSync());
const firmwareMajorVersion = response[1] + (response[2]<<8);
const firmwareMinorVersion = response[3] + (response[4]<<8);
const firmwarePatchVersion = response[5] + (response[6]<<8);
console.log(`firmwareMajorVersion: ${firmwareMajorVersion}`);
console.log(`firmwareMinorVersion: ${firmwareMinorVersion}`);
console.log(`firmwarePatchVersion: ${firmwarePatchVersion}`);

View File

@@ -6,7 +6,7 @@ let counter = 1;
while (true) { while (true) {
console.log(`hidapi sync test ${counter++}`); console.log(`hidapi sync test ${counter++}`);
const sendData = new Buffer([uhk.usbCommands.getProperty, uhk.devicePropertyIds.configSizes]); const sendData = new Buffer([uhk.usbCommands.getDeviceProperty, uhk.devicePropertyIds.configSizes]);
device.write(uhk.getTransferData(sendData)); device.write(uhk.getTransferData(sendData));
device.readSync() device.readSync()
} }

View File

@@ -10,7 +10,7 @@ let offset = 0;
let configBuffer = new Buffer(0); let configBuffer = new Buffer(0);
let chunkSizeToRead; let chunkSizeToRead;
const payload = new Buffer([uhk.usbCommands.getProperty, uhk.devicePropertyIds.configSizes]); const payload = new Buffer([uhk.usbCommands.getDeviceProperty, uhk.devicePropertyIds.configSizes]);
device.write(uhk.getTransferData(payload)); device.write(uhk.getTransferData(payload));
let buffer = Buffer.from(device.readSync()); let buffer = Buffer.from(device.readSync());
const hardwareConfigMaxSize = buffer[1] + (buffer[2]<<8); const hardwareConfigMaxSize = buffer[1] + (buffer[2]<<8);

View File

@@ -62,7 +62,7 @@ exports = module.exports = moduleExports = {
getTransferData, getTransferData,
checkModuleSlot, checkModuleSlot,
usbCommands: { usbCommands: {
getProperty : 0x00, getDeviceProperty : 0x00,
reenumerate : 0x01, reenumerate : 0x01,
jumpToModuleBootloader : 0x02, jumpToModuleBootloader : 0x02,
sendKbootCommandToModule: 0x03, sendKbootCommandToModule: 0x03,
@@ -76,7 +76,7 @@ exports = module.exports = moduleExports = {
getDebugBuffer : 0x0b, getDebugBuffer : 0x0b,
getAdcValue : 0x0c, getAdcValue : 0x0c,
setLedPwmBrightness : 0x0d, setLedPwmBrightness : 0x0d,
getModuleProperties : 0x0e, getModuleProperty : 0x0e,
}, },
enumerationModes: { enumerationModes: {
bootloader: 0, bootloader: 0,
@@ -102,6 +102,9 @@ exports = module.exports = moduleExports = {
protocolVersions: 1, protocolVersions: 1,
configSizes: 2, configSizes: 2,
}, },
modulePropertyIds: {
protocolVersions: 0,
},
configBufferIds, configBufferIds,
eepromOperations, eepromOperations,
eepromTransfer: { eepromTransfer: {

View File

@@ -23,7 +23,7 @@ let offset = 0;
let configBuffer = fs.readFileSync(configBin); let configBuffer = fs.readFileSync(configBin);
let chunkSizeToRead; let chunkSizeToRead;
const payload = new Buffer([uhk.usbCommands.getProperty, uhk.devicePropertyIds.configSizes]); const payload = new Buffer([uhk.usbCommands.getDeviceProperty, uhk.devicePropertyIds.configSizes]);
device.write(uhk.getTransferData(payload)); device.write(uhk.getTransferData(payload));
let buffer = Buffer.from(device.readSync()); let buffer = Buffer.from(device.readSync());