badusb js paritally fix

This commit is contained in:
MX 2024-10-16 01:11:34 +03:00
parent ac3c6dc4f9
commit a1993a528d
No known key found for this signature in database
GPG Key ID: 7CCC66B7DBDD1C83
2 changed files with 17 additions and 5 deletions

View File

@ -1,15 +1,16 @@
let badusb = require("badusb");
let notify = require("notification");
let flipper = require("flipper");
let dialog = require("dialog");
let gui = require("gui");
let dialog = require("gui/dialog");
// TODO: Add event loop from ofw
badusb.setup({
vid: 0xAAAA,
pid: 0xBBBB,
mfr_name: "Flipper",
prod_name: "Zero",
mfrName: "Flipper",
prodName: "Zero",
layout_path: "/ext/badusb/assets/layouts/en-US.kl"
});
let views = {
@ -38,7 +39,7 @@ if (badusb.isConnected()) {
badusb.println("Flipper Model: " + flipper.getModel());
badusb.println("Flipper Name: " + flipper.getName());
badusb.println("Battery level: " + to_string(flipper.getBatteryCharge()) + "%");
badusb.println("Battery level: " + toString(flipper.getBatteryCharge()) + "%");
// Alt+Numpad method works only on Windows!!!
badusb.altPrintln("This was printed with Alt+Numpad method!");

View File

@ -34,7 +34,7 @@ export type KeyCode = MainKey | ModifierKey | number;
* @brief Initializes the module
* @param settings USB device settings. Omit to select default parameters
*/
export declare function setup(settings?: { vid: number, pid: number, mfrName?: string, prodName?: string }): void;
export declare function setup(settings?: { vid: number, pid: number, mfrName?: string, prodName?: string, layout_path: string }): void;
/**
* @brief Tells whether the virtual USB HID device has successfully connected
@ -79,3 +79,14 @@ export declare function print(string: string, delay?: number): void;
* @param delay How many milliseconds to wait between key presses
*/
export declare function println(string: string, delay?: number): void;
/**
* @brief Prints a string by Alt+Numpad method - works only on Windows!
* @param string The string to print
*/
export declare function altPrintln(string: string): void;
/**
* @brief Releases usb, Optional, but allows to interchange with usbdisk
*/
export declare function quit(): void;