Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d3295c5666 | ||
|
|
216793bbb8 | ||
|
|
558c8b0dbf | ||
|
|
e3c65f77df | ||
|
|
227f8f0d2c | ||
|
|
7e0bc39de1 | ||
|
|
c4d3648f73 |
@@ -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/).
|
||||
|
||||
## [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
|
||||
|
||||
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
2
package-lock.json
generated
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "uhk-agent",
|
||||
"version": "1.0.2",
|
||||
"version": "1.0.3",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"private": true,
|
||||
"author": "Ultimate Gadget Laboratories",
|
||||
"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.",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
2350
packages/uhk-web/package-lock.json
generated
2350
packages/uhk-web/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -4,44 +4,37 @@
|
||||
</h1>
|
||||
<div class="row led-setting">
|
||||
<div class="col-xs-12 col-md-6">
|
||||
<label>LED display icon and layer texts brightness</label>
|
||||
<div class="slider-wrapper-container">
|
||||
<slider-wrapper
|
||||
[min]="0"
|
||||
[max]="255"
|
||||
[step]="1"
|
||||
[pips]="sliderPips"
|
||||
[(ngModel)]="iconsAndLayerTextsBrightness"
|
||||
(ngModelChange)="onSetPropertyValue('iconsAndLayerTextsBrightness', $event)"></slider-wrapper>
|
||||
</div>
|
||||
|
||||
<slider-wrapper
|
||||
label="LED display icon and layer texts brightness"
|
||||
[min]="0"
|
||||
[max]="255"
|
||||
[step]="1"
|
||||
[pips]="sliderPips"
|
||||
[(ngModel)]="iconsAndLayerTextsBrightness"
|
||||
(ngModelChange)="onSetPropertyValue('iconsAndLayerTextsBrightness', $event)"></slider-wrapper>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row led-setting">
|
||||
<div class="col-xs-12 col-md-6">
|
||||
<label>LED display alphanumeric segments brightness</label>
|
||||
<div class="slider-wrapper-container">
|
||||
<slider-wrapper
|
||||
[min]="0"
|
||||
[max]="255"
|
||||
[step]="1"
|
||||
[pips]="sliderPips"
|
||||
[(ngModel)]="alphanumericSegmentsBrightness"
|
||||
(ngModelChange)="onSetPropertyValue('alphanumericSegmentsBrightness', $event)"></slider-wrapper>
|
||||
</div>
|
||||
<slider-wrapper
|
||||
label="LED display alphanumeric segments brightness"
|
||||
[min]="0"
|
||||
[max]="255"
|
||||
[step]="1"
|
||||
[pips]="sliderPips"
|
||||
[(ngModel)]="alphanumericSegmentsBrightness"
|
||||
(ngModelChange)="onSetPropertyValue('alphanumericSegmentsBrightness', $event)"></slider-wrapper>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row led-setting">
|
||||
<div class="col-xs-12 col-md-6">
|
||||
<label>Key backlight brightness</label>
|
||||
<div class="slider-wrapper-container">
|
||||
<slider-wrapper
|
||||
[min]="0"
|
||||
[max]="255"
|
||||
[step]="1"
|
||||
[pips]="sliderPips"
|
||||
[(ngModel)]="keyBacklightBrightness"
|
||||
(ngModelChange)="onSetPropertyValue('keyBacklightBrightness', $event)"></slider-wrapper>
|
||||
</div>
|
||||
<slider-wrapper
|
||||
label="Key backlight brightness"
|
||||
[min]="0"
|
||||
[max]="255"
|
||||
[step]="1"
|
||||
[pips]="sliderPips"
|
||||
[(ngModel)]="keyBacklightBrightness"
|
||||
(ngModelChange)="onSetPropertyValue('keyBacklightBrightness', $event)"></slider-wrapper>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -12,8 +12,4 @@
|
||||
.led-setting {
|
||||
margin-bottom: 6rem;
|
||||
}
|
||||
|
||||
.slider-wrapper-container {
|
||||
margin-left: 1.6rem;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,41 @@
|
||||
<i class="fa fa-sliders"></i>
|
||||
<span>Mouse speed</span>
|
||||
</h1>
|
||||
<p>
|
||||
Coming soon ...
|
||||
</p>
|
||||
<h3>Mouse pointer speed</h3>
|
||||
<div class="row mouse-speed-setting" *ngFor="let prop of moveProps">
|
||||
<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>
|
||||
@@ -4,4 +4,25 @@
|
||||
height: 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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({
|
||||
selector: 'device-mouse-speed',
|
||||
@@ -8,5 +18,131 @@ import { Component } from '@angular/core';
|
||||
'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());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,24 @@
|
||||
<div class="slider-container">
|
||||
<nouislider
|
||||
[min]="min"
|
||||
[max]="max"
|
||||
[step]="step"
|
||||
[keyboard]="true"
|
||||
[tooltips]="true"
|
||||
[(ngModel)]="value"
|
||||
(ngModelChange)="onSliderChange($event)"></nouislider>
|
||||
</div>
|
||||
<div class="slider-value">
|
||||
<div class="value-indicator">{{value}} {{valueUnit}}</div>
|
||||
<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
|
||||
[min]="min"
|
||||
[max]="max"
|
||||
[step]="step"
|
||||
[keyboard]="true"
|
||||
[tooltips]="true"
|
||||
[(ngModel)]="value"
|
||||
(ngModelChange)="onSliderChange($event)"></nouislider>
|
||||
</div>
|
||||
<div class="slider-value">
|
||||
<div class="value-indicator">{{value}} {{valueUnit}}</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,6 +1,18 @@
|
||||
:host {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
label {
|
||||
display: block;
|
||||
font-weight: normal;
|
||||
|
||||
icon {
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
|
||||
.slider-wrapper {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
padding-left: 1.6rem;
|
||||
}
|
||||
|
||||
.slider-container {
|
||||
width: 80%;
|
||||
|
||||
@@ -13,6 +13,14 @@ export interface SliderPips {
|
||||
stepped?: boolean;
|
||||
}
|
||||
|
||||
export interface SliderProps {
|
||||
min: number;
|
||||
max: number;
|
||||
step?: number;
|
||||
pips?: SliderPips;
|
||||
valueUnit?: string;
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'slider-wrapper',
|
||||
templateUrl: './slider-wrapper.component.html',
|
||||
@@ -23,6 +31,8 @@ export interface SliderPips {
|
||||
})
|
||||
export class SliderWrapperComponent implements AfterViewInit, ControlValueAccessor, OnDestroy {
|
||||
@ViewChild(NouisliderComponent) slider: NouisliderComponent;
|
||||
@Input() label: string;
|
||||
@Input() tooltip: string;
|
||||
@Input() min: number;
|
||||
@Input() max: number;
|
||||
@Input() step: number;
|
||||
|
||||
@@ -4917,7 +4917,7 @@
|
||||
null,
|
||||
{
|
||||
"keyActionType": "mouse",
|
||||
"mouseAction": "scrollUp"
|
||||
"mouseAction": "scrollDown"
|
||||
},
|
||||
{
|
||||
"keyActionType": "mouse",
|
||||
@@ -4936,7 +4936,7 @@
|
||||
null,
|
||||
{
|
||||
"keyActionType": "mouse",
|
||||
"mouseAction": "scrollDown"
|
||||
"mouseAction": "scrollUp"
|
||||
},
|
||||
null,
|
||||
null,
|
||||
@@ -5926,7 +5926,7 @@
|
||||
null,
|
||||
{
|
||||
"keyActionType": "mouse",
|
||||
"mouseAction": "scrollUp"
|
||||
"mouseAction": "scrollDown"
|
||||
},
|
||||
{
|
||||
"keyActionType": "mouse",
|
||||
@@ -5945,7 +5945,7 @@
|
||||
null,
|
||||
{
|
||||
"keyActionType": "mouse",
|
||||
"mouseAction": "scrollDown"
|
||||
"mouseAction": "scrollUp"
|
||||
},
|
||||
null,
|
||||
null,
|
||||
@@ -6927,7 +6927,7 @@
|
||||
null,
|
||||
{
|
||||
"keyActionType": "mouse",
|
||||
"mouseAction": "scrollUp"
|
||||
"mouseAction": "scrollDown"
|
||||
},
|
||||
{
|
||||
"keyActionType": "mouse",
|
||||
@@ -6946,7 +6946,7 @@
|
||||
null,
|
||||
{
|
||||
"keyActionType": "mouse",
|
||||
"mouseAction": "scrollDown"
|
||||
"mouseAction": "scrollUp"
|
||||
},
|
||||
null,
|
||||
null,
|
||||
|
||||
@@ -193,7 +193,6 @@ import { SliderWrapperComponent } from './components/slider-wrapper/slider-wrapp
|
||||
DataStorageRepositoryService,
|
||||
DefaultUserConfigurationService,
|
||||
LogService,
|
||||
DefaultUserConfigurationService,
|
||||
AppUpdateRendererService,
|
||||
AppRendererService,
|
||||
IpcCommonRenderer,
|
||||
|
||||
@@ -16,6 +16,7 @@ export const ActionTypes = {
|
||||
SAVE_TO_KEYBOARD_FAILED: type(PREFIX + 'save to keyboard failed'),
|
||||
HIDE_SAVE_TO_KEYBOARD_BUTTON: type(PREFIX + 'hide save to keyboard button'),
|
||||
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_WITH: type(PREFIX + 'update firmware with'),
|
||||
UPDATE_FIRMWARE_REPLY: type(PREFIX + 'update firmware reply'),
|
||||
@@ -109,6 +110,10 @@ export class UpdateFirmwareOkButtonAction implements Action {
|
||||
type = ActionTypes.UPDATE_FIRMWARE_OK_BUTTON;
|
||||
}
|
||||
|
||||
export class ResetMouseSpeedSettingsAction implements Action {
|
||||
type = ActionTypes.RESET_MOUSE_SPEED_SETTINGS;
|
||||
}
|
||||
|
||||
export type Actions
|
||||
= SetPrivilegeOnLinuxAction
|
||||
| SetPrivilegeOnLinuxReplyAction
|
||||
@@ -119,6 +124,7 @@ export type Actions
|
||||
| SaveToKeyboardSuccessAction
|
||||
| SaveToKeyboardSuccessFailed
|
||||
| HideSaveToKeyboardButton
|
||||
| ResetMouseSpeedSettingsAction
|
||||
| ResetUserConfigurationAction
|
||||
| UpdateFirmwareAction
|
||||
| UpdateFirmwareWithAction
|
||||
|
||||
@@ -130,6 +130,30 @@ export class DeviceEffects {
|
||||
.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$
|
||||
.ofType(ActionTypes.RESET_USER_CONFIGURATION)
|
||||
.switchMap(() => {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
const uhk = require('./uhk');
|
||||
|
||||
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));
|
||||
const response = Buffer.from(device.readSync());
|
||||
|
||||
|
||||
16
packages/usb/get-left-firmware-version.js
Executable file
16
packages/usb/get-left-firmware-version.js
Executable 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}`);
|
||||
@@ -3,7 +3,7 @@ const uhk = require('./uhk');
|
||||
const device = uhk.getUhkDevice();
|
||||
|
||||
function getModuleState() {
|
||||
const payload = new Buffer([uhk.usbCommands.getModuleProperties, 1]);
|
||||
const payload = new Buffer([uhk.usbCommands.getModuleProperty, 1]);
|
||||
console.log('Sending ', uhk.bufferToString(payload));
|
||||
device.write(uhk.getTransferData(payload));
|
||||
const receivedBuffer = device.readSync();
|
||||
|
||||
15
packages/usb/get-right-firmware-version.js
Executable file
15
packages/usb/get-right-firmware-version.js
Executable 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}`);
|
||||
@@ -6,7 +6,7 @@ let counter = 1;
|
||||
|
||||
while (true) {
|
||||
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.readSync()
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ let offset = 0;
|
||||
let configBuffer = new Buffer(0);
|
||||
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));
|
||||
let buffer = Buffer.from(device.readSync());
|
||||
const hardwareConfigMaxSize = buffer[1] + (buffer[2]<<8);
|
||||
|
||||
@@ -62,7 +62,7 @@ exports = module.exports = moduleExports = {
|
||||
getTransferData,
|
||||
checkModuleSlot,
|
||||
usbCommands: {
|
||||
getProperty : 0x00,
|
||||
getDeviceProperty : 0x00,
|
||||
reenumerate : 0x01,
|
||||
jumpToModuleBootloader : 0x02,
|
||||
sendKbootCommandToModule: 0x03,
|
||||
@@ -76,7 +76,7 @@ exports = module.exports = moduleExports = {
|
||||
getDebugBuffer : 0x0b,
|
||||
getAdcValue : 0x0c,
|
||||
setLedPwmBrightness : 0x0d,
|
||||
getModuleProperties : 0x0e,
|
||||
getModuleProperty : 0x0e,
|
||||
},
|
||||
enumerationModes: {
|
||||
bootloader: 0,
|
||||
@@ -102,6 +102,9 @@ exports = module.exports = moduleExports = {
|
||||
protocolVersions: 1,
|
||||
configSizes: 2,
|
||||
},
|
||||
modulePropertyIds: {
|
||||
protocolVersions: 0,
|
||||
},
|
||||
configBufferIds,
|
||||
eepromOperations,
|
||||
eepromTransfer: {
|
||||
|
||||
@@ -23,7 +23,7 @@ let offset = 0;
|
||||
let configBuffer = fs.readFileSync(configBin);
|
||||
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));
|
||||
let buffer = Buffer.from(device.readSync());
|
||||
|
||||
Reference in New Issue
Block a user