Commit Graph

35 Commits

Author SHA1 Message Date
Dennis Potter f4559e6cd8 Solved problems with append function
* Modifiers are not truncated anymore by refresh function
* The append function now really appends to previously set keys
* Added reference to the wiki with more information on invalid
combinations
2018-11-27 16:19:25 +01:00
Dennis Potter 45967d5728 Added note about broken append function 2018-11-27 14:07:47 +01:00
Dennis Potter 841f90fb6e Root access is not necessary anymore for list subcommand 2018-11-27 14:07:18 +01:00
Dennis Potter e477ffc673 Completed README
Added general information, information about installation, usage, and
about problems with the PCSensor foot switches.
2018-11-26 17:40:51 +01:00
Dennis Potter 2e4e1bb2c7 Added list of supported foot switches to header 2018-11-26 17:40:35 +01:00
Dennis Potter bdb4a01487 Added append key feature
By adding this feature, all initially planned functionality is now covered by
the application.
2018-11-26 13:11:51 +01:00
Dennis Potter daf88336eb Changed format of printed keys
Now it is easier to distinguish between strings and actual keys. For
example: <esc> or <e><s><c>.
2018-11-26 12:51:11 +01:00
Dennis Potter 44c542d99a Finished do-not-purge feature. Closes #3
This feature is not yet tested on the Append:: functions since not all
functions are yet implemented. As soon as they get implemented, this
feature will be verified on them as well.

Furthermore, a Clear function is added.

Finally, in this commit, mouse_left, mouse_right, mouse_middle, and mouse_double got
abbreviated to left, right, middle, and double.
2018-11-23 18:48:39 +01:00
Dennis Potter 43f63c002b Added beginning of function to preserve settings
This is the beginning of a solution to issue #3. Right now, it is only
able to preserve keys. In a later commit, modifiers, mouse settings,
etc. will be added as well.
2018-11-14 01:29:39 +01:00
Dennis Potter 74e23a5b5f Improved user-friendliness. Closes #7
Every function is now a separate subcommand:
 * append (append a key, a modifier, or a string to one or more pedals)
 * clear (clear one or more pedals)
 * help (print a help message)
 * list (print a table with all possible keys)
 * read (read values from the footpedal)
 * set (set a key or mousebutton to one or more pedals)

A disadvantage is that different subcommands cannot be combined in one
call of the application anymore. However, this new structure brings the
major benefit that the program is more intuitive for users.

A second, small change is the fact that the welcome() function now reads
application and authore name from the Cargo file.
2018-11-14 00:20:51 +01:00
Dennis Potter dc9def512c Made footswitch-rs work with rustc >=1.30. Solves #8 2018-11-13 12:32:42 +01:00
Dennis Potter 00070237e7 Moved HidDevice to struct Pedals. Closes #2
A recent update of hidapi made this possible.
2018-11-13 00:21:08 +01:00
Dennis Potter bef171200e Fixed minor bug within read_pedals(3) 2018-08-07 00:52:56 +02:00
Dennis Potter 6fd43a14ed It is now possible to add mouse directions.
Furthermore, it is now possible to read keys, mousedirections, and
mousepedals on the same pedal with print_mouse_key(1)
2018-08-07 00:48:16 +02:00
Dennis Potter 0d55a26626 Added possibility to write and read mouse buttons to device
Furthermore, I did a small refactoring of the naming conventions for the
enum functions. Instead of vague terms liek value and string, they are
now called u8_to_enum, str_to_enum, or enum_to_str.
2018-08-06 01:10:44 +02:00
Dennis Potter a948232b3e Applications is now able to read modifiers 2018-08-01 01:15:42 +02:00
Dennis Potter e6a23707b3 Added support to write modifiers to footswitch.
Reading modifiers is not yet supported. This will be supported in the
next commit.
2018-08-01 01:00:21 +02:00
Dennis Potter 3122491557 Changed layout of table. Fixes #5 2018-07-31 00:54:15 +02:00
Dennis Potter 897bb28db5 Added types and append_string command
Application is now able to set the types (Key, Mouse, MouseKey, String),
which are saved in a struct, with a function. Furthermore, the
application can check the returned type of the board with a match.

This commit also implements the append string functionallity.
2018-07-31 00:34:35 +02:00
Dennis Potter 6e05947498 Removed all remaining unwrap() and expect() functions from main.rs
They now make use of the messages.rs error messages.
2018-07-27 23:43:24 +02:00
Dennis Potter 1e7907358f Replaced -v/--value by -i/--input
Users could make the mistake and set -V, which is valid in every scrope,
in stead of -v. This could result in for the user unexplainable
behaviour.
2018-07-26 18:44:28 +02:00
Dennis Potter acf5729180 Fixed accidental committed move and fixed unused functions warnings
The accidental commit took place in
3558a4869a. Modules were not declared public which caused warnings in these modules
2018-07-26 18:20:53 +02:00
Dennis Potter 82abb70314 Forgot to add this file in commit 3558a4869a
This file is necessary to completely resolve issue #4
2018-07-26 17:17:27 +02:00
Dennis Potter 3558a4869a Added a module which nicely formats output to console. Fixes #4 2018-07-26 17:15:39 +02:00
Dennis Potter 551a97f359 This commit fully implements the read and write key function
This commit included quite a lot of changes:

* The application arguments are now divided in a read and a write part.
  This is realized through structopt subcommands.
* The read and write commands are recognized in a match construction
  which takes place after the device is opened.
* I refactored some of the error messages and added more error messages
* The pedals_read() function now is able to read 1, 2, or 3 pedals.
  Furthermore, the table is now redrawn with box drawing symbols.
* The write function is tested and successfully writes a key to the
  device
2018-07-26 00:35:25 +02:00
Dennis Potter e792c72255 Removed obsolete function valid_key 2018-07-24 19:08:59 +02:00
Dennis Potter ab4dea3b5e Application is able to write keys to footpedal 2018-07-24 19:03:35 +02:00
Dennis Potter 6bc9c31ed3 Removed bug from write operations
write_pedal() doesn't throw an error anymore. Did not verify yet if keys
are set successfully.
2018-07-24 00:17:45 +02:00
Dennis Potter 60aa8037fb Added short description about HidApi
In hidapi v0.4.1 it is not yet possible to store the HidDevice in a
struct. Although there is already a pull request to implement this, it is not yet merged.
2018-07-24 00:16:28 +02:00
Dennis Potter 7c7c99d52b Moved and split read function. Added write wrapper
The read function is now moved into the Pedals object and split up to
read_pedals() (which reads all pedals and prints the output) and
read_pedal() (which only reads one pedal).

Furthermore, the beginning of write_pedal() and write_pedals() is added.
2018-07-23 23:52:10 +02:00
Dennis Potter b2a026e5e0 Started to work on pedal_operations
Created a seperate struct for the pedals. Write functions are still empty. Later, I'll move the read function to this struct too.
2018-07-18 14:26:11 +02:00
Dennis Potter a8169788c5 Finished read_pedals() function and made listkeys an Option 2018-07-11 12:02:10 +02:00
Dennis Potter ad132db462 Added print_key() and decode_byte() and fixed name of encode_byte() 2018-07-11 12:01:27 +02:00
Dennis Potter 5bf348ff7f Accidentally committed Rust's 'Hello World' example instead of main code of footswitch-rs. Fixed in this commit. 2018-07-10 23:41:58 +02:00
Dennis Potter 426dd13ca3 Initial commit. Application is able to initialize HID and read from it. Furthermore, it contains a lookup table for all keys 2018-07-10 23:36:20 +02:00