Giter Club home page Giter Club logo

Comments (23)

johnchen902 avatar johnchen902 commented on July 19, 2024 2

Stuff's here: johnchen902/linux@cb700d0

I'm too lazy to rebase it onto your tree.

from magicmouse-hid.

JoshMock avatar JoshMock commented on July 19, 2024 1

Since Arch uses rolling upgrades, I'm now on 5.10. I also pulled the latest changes from this repo and reinstalled them around the same time. One or both of those seems to have patched this up for me. Not a very scientific data point, but at least things seem better now. 🙂

from magicmouse-hid.

hagaram avatar hagaram commented on July 19, 2024 1

I've updated to kernel 5.11.1, applied changes from this repo - so we will see. Meanwhile I'll monitor udev rules.

from magicmouse-hid.

hagaram avatar hagaram commented on July 19, 2024 1

I've had esco mode already disabled prior to any changes and updates as per your documentation, so disconnects are perhaps caused by something else in my case - don't worry about it :)

In the logs you will find several reconnect events:
https://pastebin.com/JkgYVu6u

I'll read through the logs myself, as I may find some clues there.

from magicmouse-hid.

akozyreva avatar akozyreva commented on July 19, 2024

Hi @hagaram !
I implemented your fix on Manjaro GNOME. I'd like to say, that mouse works quite better now, but after ~8 hours disconnect happens and scrolling stops working. Did you have the same issue?

from magicmouse-hid.

JoshMock avatar JoshMock commented on July 19, 2024

@hagaram I'm having the same issue on Arch. Kernel is x86_64 5.10.10-arch1-1.

I've just been running effectively the same thing manually every time I reconnect my mouse. Your solution's a little cleaner. Are you automatically running it via systemd on wake or just manually when needed?

from magicmouse-hid.

RicardoEPRodrigues avatar RicardoEPRodrigues commented on July 19, 2024

Hello!

Unfortunately, I do not use Arch. In my last commit, I made some changes to make better use of modprobe. Can you please try it out?

If you want to change parameters you can now go to /etc/modprobe.d/hid-magicmouse.conf.

from magicmouse-hid.

akozyreva avatar akozyreva commented on July 19, 2024

Hi @RicardoEPRodrigues .
I installed your update. It's better, than it was before, but connect is lost after ~ 8 hours and scrolling is not working after re-connection. Is it possible to somehow return scrolling and not to restart computer (because when I run install.sh, changes apply only after restart, that means I do it almost every day)?

from magicmouse-hid.

RicardoEPRodrigues avatar RicardoEPRodrigues commented on July 19, 2024

I have not found a solution to the restarting being mandatory. For now, I need to restart the computer each time I update the drive.

Have you tried running the load script sudo scripts/magic-mouse-2-add.sh after connecting the mouse and see if the scroll works?

from magicmouse-hid.

akozyreva avatar akozyreva commented on July 19, 2024

@RicardoEPRodrigues yes, it takes effect, thanks! But you have no issues with disappear of scrolling, haven't you?

from magicmouse-hid.

RicardoEPRodrigues avatar RicardoEPRodrigues commented on July 19, 2024

I can't really say as I don't use the mouse that regularly. So perhaps I have the issue, I just don't know of it.

from magicmouse-hid.

hagaram avatar hagaram commented on July 19, 2024

@akozyreva Hi, sorry for the late response, I need to look into it more as I yet have to find proper permanent fix for scrolling issue. Unfortunately I have really little time on my hands.

I'm still running into the same issue, scrolling still gets lost...

My (and I must say shitty workaround) is to have mouse-reset.Desktop shortcut pinned in panel/taskbar (whatever you call it). If I lose connection, mouse gets reconnected and scrolling isn't working - I just click the icon/shortcut.

In the Exec part of Desktop file I have sudo rmmod hid_magicmouse; sudo modprobe hid_magicmouse. I allowed my user to run these commands with sudo without inserting password in sudoers.

My connection gets lost once or twice a day, so it is bearable.

They are the same commands the script (#7 (comment)) should run and runs, but something isn't working as it should.

from magicmouse-hid.

RicardoEPRodrigues avatar RicardoEPRodrigues commented on July 19, 2024

@hagaram I am running Ubuntu with kernel 5.8, so I guess it might be an issue related to changes made in kernel 5.9, although I can not say.

You might want to take a look at the UDEV rule that is calling the script. Try to see if it is being called or not (I don't remember exactly how you do it thou).

I made some recent changes to the code, so it might help to uninstall the previous versions and try it out from the latest release, but I don't think the problem will be solved.

from magicmouse-hid.

RicardoEPRodrigues avatar RicardoEPRodrigues commented on July 19, 2024

Some reports seem to suggest this is, in fact, a kernel problem: https://bbs.archlinux.org/viewtopic.php?id=259954

Can you confirm you have the same or similar issues?

from magicmouse-hid.

RicardoEPRodrigues avatar RicardoEPRodrigues commented on July 19, 2024

Thank you both for your time. Let me know how it goes and let's hope it was a Kernel bug. 😊

from magicmouse-hid.

hagaram avatar hagaram commented on July 19, 2024

Today, I had more disconnects than avg (+2), which might be completely unrelated to changes you made, or changes made in the kernel.

BUT the good news is, that it seems, than scroll works correctly after disconnect-reconnect. I would't close this issue just yet, as I would give it few more days of testing - I use the mouse daily.

If you are interested I can provide udev logs, maybe it will come in handy in the future.

from magicmouse-hid.

RicardoEPRodrigues avatar RicardoEPRodrigues commented on July 19, 2024

Great news. If you can share a pastebin link for the logs it would be nice, just to see what we are working with.

Also, supposedly the install script disables something in Bluetooth that should fix the disconnecting issue. Perhaps the current solution doesn't work on Arch, but you should google it.

# Disable eSCO mode in Bluetooth to fix disconnection problems with the mouse
echo 1 | tee /sys/module/bluetooth/parameters/disable_esco
systemctl restart bluetooth
# persist eSCO mode in Bluetooth setting
echo "options bluetooth disable_esco=1" | tee /etc/modprobe.d/bluetooth-tweaks.conf

from magicmouse-hid.

johnchen902 avatar johnchen902 commented on July 19, 2024

My current uname -r is 5.11.8-arch1-1. If the module is loaded after the mouse connects, it receives events of size 14, 22, 30, etc. However, if the module is loaded before the mouse connect, it receives events of size 8.


Add this line to magicmouse_raw_event:

printk(KERN_INFO "magicmouse_raw_event size=%d data[0]=%d\n", size, (int) data[0]);

If the module is loaded after the mouse connects:

magicmouse_raw_event size=22 data[0]=18
magicmouse_raw_event size=14 data[0]=18

If the module is loaded before the mouse connects:

magicmouse_raw_event size=8 data[0]=18

from magicmouse-hid.

johnchen902 avatar johnchen902 commented on July 19, 2024

If the module is loaded before the mouse connects, it appears that hid_hw_raw_request did return -EIO.

from magicmouse-hid.

johnchen902 avatar johnchen902 commented on July 19, 2024

It's HIDP_HSHK_ERR_INVALID_REPORT_ID. Since the mouse did not switch into multitouch mode, we can't put a blind eye on it.

from magicmouse-hid.

johnchen902 avatar johnchen902 commented on July 19, 2024

Adding msleep(500) seems to resolve the problem. I don't know if this is a device quirk or a driver bug, though.

static int hid_magicmuose2_enable_multitouch(struct hid_device *hdev)
{
	u8 data[] = { 0xF1, 0x02, 0x01 };
	return hid_hw_raw_request(hdev, data[0], data, sizeof(data),
			HID_FEATURE_REPORT, HID_REQ_SET_REPORT);
}

static int hid_magicmouse2_probe(struct hid_device *hdev,
			     const struct hid_device_id *id)
{
	// ...
	ret = hid_magicmuose2_enable_multitouch(hdev);
	if (ret < 0) {
		msleep(500);  // device quirk?
		
		ret = hid_magicmuose2_enable_multitouch(hdev);
		if (ret < 0)
			return ret;
	}
	// ...
}

from magicmouse-hid.

RicardoEPRodrigues avatar RicardoEPRodrigues commented on July 19, 2024

I think it isn't code-breaking. Can you do a Pull Request and I'll test it out?

from magicmouse-hid.

RicardoEPRodrigues avatar RicardoEPRodrigues commented on July 19, 2024

@johnchen902 I applied your changes to this codebase. Thank you for your work! 👍

Additionally, I added a new feature - disable scrolling while moving the mouse. All of these features should go into libinput, but I don't have the time and knowledge to do so.

from magicmouse-hid.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.