makcu 0.1.2__tar.gz → 0.1.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: makcu
3
- Version: 0.1.2
3
+ Version: 0.1.4
4
4
  Summary: Python library to interact with Makcu devices.
5
5
  Author: SleepyTotem
6
6
  License: GPL
@@ -50,14 +50,6 @@ python -m makcu [command]
50
50
  | `--testPort COM3` | Tests a specific COM port for connectivity |
51
51
  | `--runtest` | Runs all automated tests and opens a test report |
52
52
 
53
- ### Examples
54
-
55
- ```bash
56
- python -m makcu --debug
57
- python -m makcu --testPort COM3
58
- python -m makcu --runtest
59
- ```
60
-
61
53
  ---
62
54
 
63
55
  ## 🧠 Quickstart (Python)
@@ -65,7 +57,7 @@ python -m makcu --runtest
65
57
  ```python
66
58
  from makcu import create_controller, MouseButton
67
59
 
68
- makcu = create_controller("COM1") # Fallback port
60
+ makcu = create_controller("COM1")
69
61
  makcu.click(MouseButton.LEFT)
70
62
  makcu.move(100, 50)
71
63
  makcu.scroll(-1)
@@ -79,20 +71,14 @@ makcu.disconnect()
79
71
  ### 🔧 Initialization
80
72
 
81
73
  ```python
82
- makcu = create_controller(debug=True, send_init=True)
83
- ```
84
-
85
- #### Set fallback port manually
86
-
87
- ```python
88
- makcu = create_controller("COM4") # Optional fallback com port
74
+ makcu = create_controller(fallback_com_port="COM1", debug=True, send_init=True)
89
75
  ```
90
76
 
91
77
  ---
92
78
 
93
79
  ### 🎮 Mouse Control
94
80
 
95
- #### Clicks
81
+ #### Button Actions
96
82
 
97
83
  ```python
98
84
  makcu.click(MouseButton.LEFT)
@@ -103,21 +89,21 @@ makcu.release(MouseButton.RIGHT)
103
89
  #### Movement
104
90
 
105
91
  ```python
106
- makcu.move(dx=30, dy=20)
92
+ makcu.move(30, 20)
107
93
  makcu.move_smooth(100, 40, segments=10)
108
94
  makcu.move_bezier(50, 50, 15, ctrl_x=25, ctrl_y=25)
109
95
  ```
110
96
 
111
- #### Scrolling
97
+ #### Scroll Wheel
112
98
 
113
99
  ```python
114
- makcu.scroll(-3) # Scroll down
115
- makcu.scroll(3) # Scroll up
100
+ makcu.scroll(-3)
101
+ makcu.scroll(3)
116
102
  ```
117
103
 
118
104
  ---
119
105
 
120
- ### 🔒 Locking and Unlocking
106
+ ### 🔒 Locking
121
107
 
122
108
  ```python
123
109
  makcu.lock_left(True)
@@ -129,10 +115,10 @@ makcu.lock_mouse_x(True)
129
115
  makcu.lock_mouse_y(False)
130
116
  ```
131
117
 
132
- #### Lock Status
118
+ #### Lock State Query
133
119
 
134
120
  ```python
135
- makcu.is_button_locked(MouseButton.LEFT)
121
+ makcu.is_locked(MouseButton.LEFT)
136
122
  makcu.get_all_lock_states()
137
123
  ```
138
124
 
@@ -144,7 +130,7 @@ makcu.get_all_lock_states()
144
130
  makcu.click_human_like(
145
131
  button=MouseButton.LEFT,
146
132
  count=5,
147
- profile="normal", # "fast", "slow" also available
133
+ profile="normal", # or "fast", "slow"
148
134
  jitter=3
149
135
  )
150
136
  ```
@@ -155,10 +141,7 @@ makcu.click_human_like(
155
141
 
156
142
  ```python
157
143
  info = makcu.get_device_info()
158
- print(info)
159
-
160
144
  version = makcu.get_firmware_version()
161
- print(version)
162
145
  ```
163
146
 
164
147
  ---
@@ -172,15 +155,15 @@ makcu.reset_serial()
172
155
 
173
156
  ---
174
157
 
175
- ## 🧪 Button Monitoring & Capture
158
+ ## 🧪 Button Monitoring
176
159
 
177
- ### Enable Real-time Monitoring
160
+ ### Enable Monitoring
178
161
 
179
162
  ```python
180
163
  makcu.enable_button_monitoring(True)
181
164
  ```
182
165
 
183
- ### Set Callback Function
166
+ ### Set Event Callback
184
167
 
185
168
  ```python
186
169
  def on_button_event(button, pressed):
@@ -191,66 +174,46 @@ makcu.set_button_callback(on_button_event)
191
174
 
192
175
  ---
193
176
 
194
- ## ❌ Click Capturing (Pending Firmware Update)
195
-
196
- Click capturing will allow you to detect and count click events in software.
177
+ ## ❌ Click Capturing (Pending Firmware Fix)
197
178
 
198
179
  ```python
199
180
  makcu.mouse.lock_right(True)
200
- makcu.capture(MouseButton.RIGHT)
181
+ makcu.mouse.begin_capture("RIGHT")
201
182
 
202
- # User clicks however many times
183
+ # Simulated user input...
203
184
 
204
185
  makcu.mouse.lock_right(False)
205
- count = makcu.get_captured_clicks(MouseButton.RIGHT)
186
+ count = makcu.mouse.stop_capturing_clicks("RIGHT")
206
187
  print(f"Captured clicks: {count}")
207
188
  ```
208
189
 
209
- > ⚠️ This feature is currently broken in firmware. Do not rely on it yet.
190
+ > ⚠️ Not fully supported yet firmware must be updated to complete this feature.
210
191
 
211
192
  ---
212
193
 
213
194
  ## 🔢 Bitmask & Button States
214
195
 
215
- ### Get Bitmask of Active Buttons
216
-
217
196
  ```python
218
197
  mask = makcu.get_button_mask()
219
- print(f"Button mask: {mask}")
220
- ```
221
-
222
- ### Get Raw Button State Map
223
-
224
- ```python
225
198
  states = makcu.get_button_states()
226
- print(states) # {'left': False, 'right': True, ...}
227
- ```
228
-
229
- ### Check if a Specific Button Is Pressed
230
199
 
231
- ```python
232
- if makcu.is_button_pressed(MouseButton.RIGHT):
233
- print("Right button is pressed")
200
+ if makcu.is_pressed(MouseButton.RIGHT):
201
+ print("Right button is currently pressed")
234
202
  ```
235
203
 
236
204
  ---
237
205
 
238
- ## ⚙️ Low-Level Command Access
239
-
240
- ### Send raw serial commands
206
+ ## ⚙️ Low-Level Access
241
207
 
242
208
  ```python
243
- from makcu import create_controller
244
- makcu = create_controller()
245
209
  response = makcu.transport.send_command("km.version()", expect_response=True)
246
- print(response)
247
210
  ```
248
211
 
249
212
  ---
250
213
 
251
214
  ## 🧪 Test Suite
252
215
 
253
- Run all tests and generate HTML report:
216
+ Run full test suite and generate an HTML report:
254
217
 
255
218
  ```bash
256
219
  python -m makcu --runtest
@@ -287,11 +250,11 @@ except MakcuConnectionError as e:
287
250
 
288
251
  ## 🛠️ Developer Notes
289
252
 
290
- - Uses CH343 USB Serial
291
- - Auto-connects to correct port or fallback
292
- - Supports baud rate switching to 4M
293
- - Automatically enables `km.buttons(1)` monitoring if `send_init=True`
294
- - Supports raw button state polling
253
+ - Communicates via CH343 USB serial
254
+ - Automatically finds correct port or uses fallback
255
+ - Switches baud to 4M after initial connect
256
+ - Enables `km.buttons(1)` on init if requested
257
+ - Supports full button state tracking with events
295
258
 
296
259
  ---
297
260
 
@@ -301,10 +264,11 @@ GPL License © SleepyTotem
301
264
 
302
265
  ---
303
266
 
304
- ## Support
305
- Please open an issue on the project repository and I will get to it asap
267
+ ## 🙋 Support
268
+
269
+ Open an issue on GitHub if you encounter bugs or need help.
306
270
 
307
271
  ## 🌐 Links
308
272
 
309
- - 🔗 [Project Homepage](https://github.com/SleepyTotem/makcu-py-lib)
310
- - 🔗 [PyPi Homepage](https://github.com/SleepyTotem/makcu-py-lib)
273
+ - [GitHub Repo](https://github.com/SleepyTotem/makcu-py-lib)
274
+ - [PyPI Package](https://pypi.org/project/makcu/)
@@ -38,14 +38,6 @@ python -m makcu [command]
38
38
  | `--testPort COM3` | Tests a specific COM port for connectivity |
39
39
  | `--runtest` | Runs all automated tests and opens a test report |
40
40
 
41
- ### Examples
42
-
43
- ```bash
44
- python -m makcu --debug
45
- python -m makcu --testPort COM3
46
- python -m makcu --runtest
47
- ```
48
-
49
41
  ---
50
42
 
51
43
  ## 🧠 Quickstart (Python)
@@ -53,7 +45,7 @@ python -m makcu --runtest
53
45
  ```python
54
46
  from makcu import create_controller, MouseButton
55
47
 
56
- makcu = create_controller("COM1") # Fallback port
48
+ makcu = create_controller("COM1")
57
49
  makcu.click(MouseButton.LEFT)
58
50
  makcu.move(100, 50)
59
51
  makcu.scroll(-1)
@@ -67,20 +59,14 @@ makcu.disconnect()
67
59
  ### 🔧 Initialization
68
60
 
69
61
  ```python
70
- makcu = create_controller(debug=True, send_init=True)
71
- ```
72
-
73
- #### Set fallback port manually
74
-
75
- ```python
76
- makcu = create_controller("COM4") # Optional fallback com port
62
+ makcu = create_controller(fallback_com_port="COM1", debug=True, send_init=True)
77
63
  ```
78
64
 
79
65
  ---
80
66
 
81
67
  ### 🎮 Mouse Control
82
68
 
83
- #### Clicks
69
+ #### Button Actions
84
70
 
85
71
  ```python
86
72
  makcu.click(MouseButton.LEFT)
@@ -91,21 +77,21 @@ makcu.release(MouseButton.RIGHT)
91
77
  #### Movement
92
78
 
93
79
  ```python
94
- makcu.move(dx=30, dy=20)
80
+ makcu.move(30, 20)
95
81
  makcu.move_smooth(100, 40, segments=10)
96
82
  makcu.move_bezier(50, 50, 15, ctrl_x=25, ctrl_y=25)
97
83
  ```
98
84
 
99
- #### Scrolling
85
+ #### Scroll Wheel
100
86
 
101
87
  ```python
102
- makcu.scroll(-3) # Scroll down
103
- makcu.scroll(3) # Scroll up
88
+ makcu.scroll(-3)
89
+ makcu.scroll(3)
104
90
  ```
105
91
 
106
92
  ---
107
93
 
108
- ### 🔒 Locking and Unlocking
94
+ ### 🔒 Locking
109
95
 
110
96
  ```python
111
97
  makcu.lock_left(True)
@@ -117,10 +103,10 @@ makcu.lock_mouse_x(True)
117
103
  makcu.lock_mouse_y(False)
118
104
  ```
119
105
 
120
- #### Lock Status
106
+ #### Lock State Query
121
107
 
122
108
  ```python
123
- makcu.is_button_locked(MouseButton.LEFT)
109
+ makcu.is_locked(MouseButton.LEFT)
124
110
  makcu.get_all_lock_states()
125
111
  ```
126
112
 
@@ -132,7 +118,7 @@ makcu.get_all_lock_states()
132
118
  makcu.click_human_like(
133
119
  button=MouseButton.LEFT,
134
120
  count=5,
135
- profile="normal", # "fast", "slow" also available
121
+ profile="normal", # or "fast", "slow"
136
122
  jitter=3
137
123
  )
138
124
  ```
@@ -143,10 +129,7 @@ makcu.click_human_like(
143
129
 
144
130
  ```python
145
131
  info = makcu.get_device_info()
146
- print(info)
147
-
148
132
  version = makcu.get_firmware_version()
149
- print(version)
150
133
  ```
151
134
 
152
135
  ---
@@ -160,15 +143,15 @@ makcu.reset_serial()
160
143
 
161
144
  ---
162
145
 
163
- ## 🧪 Button Monitoring & Capture
146
+ ## 🧪 Button Monitoring
164
147
 
165
- ### Enable Real-time Monitoring
148
+ ### Enable Monitoring
166
149
 
167
150
  ```python
168
151
  makcu.enable_button_monitoring(True)
169
152
  ```
170
153
 
171
- ### Set Callback Function
154
+ ### Set Event Callback
172
155
 
173
156
  ```python
174
157
  def on_button_event(button, pressed):
@@ -179,66 +162,46 @@ makcu.set_button_callback(on_button_event)
179
162
 
180
163
  ---
181
164
 
182
- ## ❌ Click Capturing (Pending Firmware Update)
183
-
184
- Click capturing will allow you to detect and count click events in software.
165
+ ## ❌ Click Capturing (Pending Firmware Fix)
185
166
 
186
167
  ```python
187
168
  makcu.mouse.lock_right(True)
188
- makcu.capture(MouseButton.RIGHT)
169
+ makcu.mouse.begin_capture("RIGHT")
189
170
 
190
- # User clicks however many times
171
+ # Simulated user input...
191
172
 
192
173
  makcu.mouse.lock_right(False)
193
- count = makcu.get_captured_clicks(MouseButton.RIGHT)
174
+ count = makcu.mouse.stop_capturing_clicks("RIGHT")
194
175
  print(f"Captured clicks: {count}")
195
176
  ```
196
177
 
197
- > ⚠️ This feature is currently broken in firmware. Do not rely on it yet.
178
+ > ⚠️ Not fully supported yet firmware must be updated to complete this feature.
198
179
 
199
180
  ---
200
181
 
201
182
  ## 🔢 Bitmask & Button States
202
183
 
203
- ### Get Bitmask of Active Buttons
204
-
205
184
  ```python
206
185
  mask = makcu.get_button_mask()
207
- print(f"Button mask: {mask}")
208
- ```
209
-
210
- ### Get Raw Button State Map
211
-
212
- ```python
213
186
  states = makcu.get_button_states()
214
- print(states) # {'left': False, 'right': True, ...}
215
- ```
216
-
217
- ### Check if a Specific Button Is Pressed
218
187
 
219
- ```python
220
- if makcu.is_button_pressed(MouseButton.RIGHT):
221
- print("Right button is pressed")
188
+ if makcu.is_pressed(MouseButton.RIGHT):
189
+ print("Right button is currently pressed")
222
190
  ```
223
191
 
224
192
  ---
225
193
 
226
- ## ⚙️ Low-Level Command Access
227
-
228
- ### Send raw serial commands
194
+ ## ⚙️ Low-Level Access
229
195
 
230
196
  ```python
231
- from makcu import create_controller
232
- makcu = create_controller()
233
197
  response = makcu.transport.send_command("km.version()", expect_response=True)
234
- print(response)
235
198
  ```
236
199
 
237
200
  ---
238
201
 
239
202
  ## 🧪 Test Suite
240
203
 
241
- Run all tests and generate HTML report:
204
+ Run full test suite and generate an HTML report:
242
205
 
243
206
  ```bash
244
207
  python -m makcu --runtest
@@ -275,11 +238,11 @@ except MakcuConnectionError as e:
275
238
 
276
239
  ## 🛠️ Developer Notes
277
240
 
278
- - Uses CH343 USB Serial
279
- - Auto-connects to correct port or fallback
280
- - Supports baud rate switching to 4M
281
- - Automatically enables `km.buttons(1)` monitoring if `send_init=True`
282
- - Supports raw button state polling
241
+ - Communicates via CH343 USB serial
242
+ - Automatically finds correct port or uses fallback
243
+ - Switches baud to 4M after initial connect
244
+ - Enables `km.buttons(1)` on init if requested
245
+ - Supports full button state tracking with events
283
246
 
284
247
  ---
285
248
 
@@ -289,10 +252,11 @@ GPL License © SleepyTotem
289
252
 
290
253
  ---
291
254
 
292
- ## Support
293
- Please open an issue on the project repository and I will get to it asap
255
+ ## 🙋 Support
256
+
257
+ Open an issue on GitHub if you encounter bugs or need help.
294
258
 
295
259
  ## 🌐 Links
296
260
 
297
- - 🔗 [Project Homepage](https://github.com/SleepyTotem/makcu-py-lib)
298
- - 🔗 [PyPi Homepage](https://github.com/SleepyTotem/makcu-py-lib)
261
+ - [GitHub Repo](https://github.com/SleepyTotem/makcu-py-lib)
262
+ - [PyPI Package](https://pypi.org/project/makcu/)
@@ -33,7 +33,7 @@ def debug_console():
33
33
  def test_port(port):
34
34
  try:
35
35
  print(f"Trying to connect to {port} (without init command)...")
36
- controller = create_controller(send_init=False)
36
+ controller = create_controller(fallback_com_port=port, send_init=False)
37
37
  print(f"✅ Successfully connected to {port}")
38
38
  controller.disconnect()
39
39
  except MakcuConnectionError as e:
@@ -47,14 +47,14 @@ def run_tests():
47
47
  package_dir = Path(__file__).resolve().parent
48
48
  test_file = package_dir / "test_suite.py"
49
49
 
50
- sys.exit(pytest.main([
50
+ result = pytest.main([
51
51
  str(test_file),
52
52
  "--rootdir", str(package_dir),
53
53
  "-v", "--tb=short",
54
54
  "--capture=tee-sys",
55
55
  "--html=latest_pytest.html",
56
56
  "--self-contained-html"
57
- ]))
57
+ ])
58
58
 
59
59
  report_path = os.path.abspath("latest_pytest.html")
60
60
  if os.path.exists(report_path):
@@ -63,11 +63,13 @@ def run_tests():
63
63
  else:
64
64
  print("❌ Report not found. Something went wrong.")
65
65
 
66
- if result.returncode != 0:
66
+ if result != 0:
67
67
  print("❌ Some tests failed.")
68
68
  else:
69
69
  print("✅ All tests passed.")
70
70
 
71
+ sys.exit(result)
72
+
71
73
  def main():
72
74
  args = sys.argv[1:]
73
75