⛏️ index : haiku.git

author Samuel Rodríguez Pérez <samuelgaliza@gmail.com> 2025-11-14 10:58:12.0 +00:00:00
committer Adrien Destugues <pulkomandy@pulkomandy.tk> 2025-12-03 7:48:12.0 +00:00:00
commit
658d2d12224284eb8593220f9c6c56c26d823c01 [patch]
tree
9ab9dbda16a8ae048793102baf7b99a7dda5270a
parent
1dfcf1b9c62c4a8476095fecc9a3ef5461ce68fb
download
658d2d12224284eb8593220f9c6c56c26d823c01.tar.gz

input mouse: Tracing cleanup fixes

- Replace LOG_ERR by LOG_ERROR. LOG_ERR is a constant on syslog.
- Fix compilation on x86_64 with TRACE_MOUSE_DEVICE enabled by:
  - Replacing %ld by %" B_PRId32 ".
  - Replacing %lu by %" B_PRIu32 ".
  - Replacing %lx by %" B_PRIx32" .

Change-Id: I8ffc4fc32e835406bfc8641f09b60489155d946a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9907
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>

Diff

 src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp b/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp
index 21c0ec8..56f5241 100644
--- a/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp
+++ b/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp
@@ -52,11 +52,11 @@
							debug_printf("%p -> %s", this, _to.String()); \
							debug_printf(x); } while (0)
#	define LOG_EVENT(text...) do {} while (0)
#	define LOG_ERR(text...) TRACE(text)
#	define LOG_ERROR(text...) TRACE(text)
#else
#	define TRACE(x...) do {} while (0)
#	define CALLED(x...) TRACE(x)
#	define LOG_ERR(x...) debug_printf(x)
#	define LOG_ERROR(x...) debug_printf(x)
#	define LOG_EVENT(x...) TRACE(x)
#endif

@@ -194,7 +194,7 @@
	}

	if (status < B_OK) {
		LOG_ERR("%s: can't spawn/resume watching thread: %s\n",
		LOG_ERROR("%s: can't spawn/resume watching thread: %s\n",
			fDeviceRef.name, strerror(status));
		if (fDevice >= 0)
			close(fDevice);
@@ -395,7 +395,7 @@
				if (errno == B_INTERRUPTED)
					continue;

				LOG_ERR("Mouse device exiting, %s\n", strerror(errno));
				LOG_ERROR("Mouse device exiting, %s\n", strerror(errno));
				_ControlThreadCleanup();
				// TOAST!
				return;
@@ -411,7 +411,7 @@
				read.event = MS_READ_TOUCHPAD;
				read.u.touchpad = lastTouchpadMovement;
			} else if (status != B_OK && status != B_INTERRUPTED) {
				LOG_ERR("Mouse (touchpad) device exiting, %s\n", strerror(errno));
				LOG_ERROR("Mouse (touchpad) device exiting, %s\n", strerror(errno));
				_ControlThreadCleanup();
				// TOAST!
				return;
@@ -452,12 +452,12 @@
		_ComputeAcceleration(movements, deltaX, deltaY, historyDeltaX,
			historyDeltaY);

		LOG_EVENT("%s: buttons: 0x%lx, x: %ld, y: %ld, clicks:%ld, "
			"wheel_x:%ld, wheel_y:%ld\n",
		LOG_EVENT("%s: buttons: 0x%" B_PRIx32 ", x: %" B_PRId32 ", y: %" B_PRId32
			", clicks:%" B_PRId32 ", wheel_x:%" B_PRId32 ", wheel_y:%" B_PRId32 "\n",
			fDeviceRef.name, movements.buttons,
			movements.xdelta, movements.ydelta, movements.clicks,
			movements.wheel_xdelta, movements.wheel_ydelta);
		LOG_EVENT("%s: x: %ld, y: %ld (%.4f, %.4f)\n", fDeviceRef.name,
		LOG_EVENT("%s: x: %" B_PRId32 ", y: %" B_PRId32 " (%.4f, %.4f)\n", fDeviceRef.name,
			deltaX, deltaY, historyDeltaX, historyDeltaY);

		// Send single messages for each event
@@ -538,7 +538,7 @@
	// retrieve current values

	if (get_mouse_map(fDeviceRef.name, &fSettings.map) != B_OK)
		LOG_ERR("error when get_mouse_map\n");
		LOG_ERROR("error when get_mouse_map\n");
	else
		fDeviceRemapsButtons = ioctl(fDevice, MS_SET_MAP, &fSettings.map) == B_OK;

@@ -547,13 +547,13 @@
			fTouchpadMovementMaker.click_speed = fSettings.click_speed;
		ioctl(fDevice, MS_SET_CLICKSPEED, &fSettings.click_speed);
	} else
		LOG_ERR("error when get_click_speed\n");
		LOG_ERROR("error when get_click_speed\n");

	if (get_mouse_speed(fDeviceRef.name, &fSettings.accel.speed) != B_OK)
		LOG_ERR("error when get_mouse_speed\n");
		LOG_ERROR("error when get_mouse_speed\n");
	else {
		if (get_mouse_acceleration(fDeviceRef.name, &fSettings.accel.accel_factor) != B_OK)
			LOG_ERR("error when get_mouse_acceleration\n");
			LOG_ERROR("error when get_mouse_acceleration\n");
		else {
			mouse_accel accel;
			ioctl(fDevice, MS_GET_ACCEL, &accel);
@@ -564,7 +564,7 @@
	}

	if (get_mouse_type(fDeviceRef.name, &fSettings.type) != B_OK)
		LOG_ERR("error when get_mouse_type\n");
		LOG_ERROR("error when get_mouse_type\n");
	else
		ioctl(fDevice, MS_SET_TYPE, &fSettings.type);
}