Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Pen issues on linux-surface #748

Open
1 task done
apmyplol opened this issue Oct 9, 2024 · 36 comments
Open
1 task done

[Bug]: Pen issues on linux-surface #748

apmyplol opened this issue Oct 9, 2024 · 36 comments
Assignees
Labels
bug Something isn't working confirmed
Milestone

Comments

@apmyplol
Copy link

apmyplol commented Oct 9, 2024

What happened?

I noticed a couple of bugs while trying out this very promising program on my linux device.
I noticed that my surface pen is not working when trying to draw, but erasing and selection etc works fine.
When doing the pointer test in the settings it recognizes my pens tip as Input 1, but does not recognize any pressure (pressure is constantly 0). I believe this might be the reason for why drawing does not work with the pen.
Moreover I noticed that the pointer test doesn't recognize the eraser at the back of the pen (Input number is 1) and that the functional button on the pen is recognized as 4 when hovering over the device and as 5 when touching the device with the pen. This makes it impossible to map them, because in the settings its only possible to map 1 and 2.

Other programs (rnote) recognize the eraser correctly.
Im using a surface device with the linux-surface kernel installed. Maybe this problem only appears on linux-surface devices.

Version

2.2.0

Platform

Linux

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@apmyplol apmyplol added the bug Something isn't working label Oct 9, 2024
@github-project-automation github-project-automation bot moved this to 📕 Todo in Butterfly Oct 9, 2024
@CodeDoctorDE
Copy link
Member

CodeDoctorDE commented Oct 10, 2024

Sadly, the first issue looks like a known bug, see #238.
The mapping of button 4 and 5 looks just like a small enhancement which i could add.
(kTertiaryButton is 4).
5 is when both 4 + 1 (kTeritaryButton + primary button) was clicked...

Btw: Which type does it say on the pointer test when touching with the stylus?

@apmyplol
Copy link
Author

For me, the pen also works like before (i.e. everything except writing with the pen tool) when enabling pen only input.
The pointer test also says pen correctly, when I use the pen.
The fact that the pen input only doesn't work for the drawing tool feels like its maybe unrelated to the issue you mentioned.

@CodeDoctorDE
Copy link
Member

Quick question: does the button value ever be 0 when having the pen on it?
Otherwise i would just remap the settings a bit that pen input = 1, first button = 2 and second button = 4

@CodeDoctorDE CodeDoctorDE added this to the 2.2 milestone Oct 10, 2024
@github-project-automation github-project-automation bot moved this from 📕 Todo to ✅ Done in Butterfly Oct 10, 2024
@CodeDoctorDE
Copy link
Member

fixed in 2.2.1-rc.1,
I use now bit masks instead of == (it's okay if you don't understand this :)), this should improve multi button handling and i'm now priorizing the secondary button over the primary button.

@apmyplol
Copy link
Author

Thank you very much for the quick fix. It will be implemented in the nightly build soon, right? Ill test it out then.

Quick question: does the button value ever be 0 when having the pen on it? Otherwise i would just remap the settings a bit that pen input = 1, first button = 2 and second button = 4

No, the input is only 0 when the pen doesnt touch the device.

@CodeDoctorDE
Copy link
Member

Yes it will be available in the next nightly Version next Monday with many other fixes.

That's good, then you don't need to change any settings and it will work out of the box in the next nightly.

@Postboote1
Copy link

Hello
I ran into the same problem with the pressure of the pen.
In the test it gets recognized but the pressure is 0.
Laser and other stuff however work.
I am on Version 2.2.1 stable

@CodeDoctorDE
Copy link
Member

yeah it's already known here #238

@Postboote1
Copy link

Postboote1 commented Nov 3, 2024

Isn't there any solution yet?

@CodeDoctorDE
Copy link
Member

Sadly not. Its an issue by the library Im using to capture the input

@Postboote1
Copy link

oh okay
thought i could use it instead of Rnote

@apmyplol
Copy link
Author

Would it be possible to include an option like "disable pen pressure recognition" which would always set the pen pressure to 1, i.e. overriding the detected pressure (which is always 0)?
Is that a possible workaround? I think this would make it possible to still use butterfly, even if the pressure isn't recognized.

@CodeDoctorDE
Copy link
Member

It should already be possible, then it just "simulate" the pressure. If you have issues, feel free to report it

@WarreTh
Copy link

WarreTh commented Jan 7, 2025

It should already be possible, then it just "simulate" the pressure. If you have issues, feel free to report it

Yeah, i tried version 2.2.3, but the pressure of my stylus isnt simulated to 1, so the pen doesnt draw.
I use kubuntu 24.04.

@CodeDoctorDE
Copy link
Member

Hmm, is it a specific value? Can you try the pointer test and write me the values?

@WarreTh
Copy link

WarreTh commented Jan 8, 2025

On the desktop app:

Image

But the mouse also show 0 pressure on the desktop app, but it still draws

On the webapp:

Image

@CodeDoctorDE
Copy link
Member

Hmm but it looks good...
The pressure should be between 0 and 1...
Im currently not sure how to test it... i currently dont have a linux stylus laptop.
Can you send me a video how it looks like if you draw something?

@WarreTh
Copy link

WarreTh commented Jan 8, 2025

I forgot to say that i use a normal linux hp device, with an xppen tablet connected. I have the official xppen drivers installed.

@CodeDoctorDE
Copy link
Member

Yeah, it looks like it should work. I use the same values as in the pointer test. If the values there is correct, it should work.

@WarreTh
Copy link

WarreTh commented Jan 8, 2025

  • Using the select tool works
    Image

  • Using the draw tool doesnt

What should i try, can i export logs or something ?

@CodeDoctorDE
Copy link
Member

It would be nice if you could try to record the screen so I can look what happened.
Logs aren't available.
It would also be useful if you could upload the .bfly file so i can see if the data is correct

@WarreTh
Copy link

WarreTh commented Jan 8, 2025

When i try to save the bfly file, the application just freezes

Here is when i try to draw:

Image

@CodeDoctorDE
Copy link
Member

Hmm, can you try visiting ~/Documents/Linwood/Butterfly/Documents and try to find the file there?

@WarreTh
Copy link

WarreTh commented Jan 8, 2025

I have no such directory

@CodeDoctorDE
Copy link
Member

Is there no linwood directory inside your documents folder?

@WarreTh
Copy link

WarreTh commented Jan 8, 2025

Nope

@CodeDoctorDE
Copy link
Member

Hmm, can you try to close the note, and export the file from the home screen?

@WarreTh
Copy link

WarreTh commented Jan 8, 2025

The application also freezes when i click the home button after drawing with my pen

@CodeDoctorDE
Copy link
Member

How did you install Butterfly?
Did it save? Then you could just go to home without drawing

@WarreTh
Copy link

WarreTh commented Jan 8, 2025

I installed it using flatpak.
I think it didnt save, because i dont find that file.

@CodeDoctorDE
Copy link
Member

hmm, now it's really tricky for me to reproduce it...
Can you try installing the app without flatpak and try to run it?

@CodeDoctorDE CodeDoctorDE reopened this Jan 8, 2025
@WarreTh
Copy link

WarreTh commented Jan 10, 2025

I installed it using the deb file, and i get the same bug.

Then i tried running the appimage and i got this error:

/home/wath/Applications/linwood_butterfly.appimage

/tmp/.mount_linwooESPJnQ/butterfly: symbol lookup error: /tmp/.mount_linwooESPJnQ/butterfly: undefined symbol: g_once_init_enter_pointer

@WarreTh
Copy link

WarreTh commented Jan 17, 2025

@CodeDoctorDE What should i try ?

@CodeDoctorDE
Copy link
Member

I have no more ideas right now, can you also try the portable version (or the alternative portable version?).
It looks like it has something to do with glibc, can you see which version do you use?

it looks like the problem isn't really related to flutter: SeaDve/Kooha#283

@WarreTh
Copy link

WarreTh commented Jan 17, 2025

I tried the alternative version and get this error when trying to draw with my stylus

[ERROR:flutter/runtime/dart_vm_initializer.cc(40)] Unhandled Exception: Converting object to an encodable object failed: NaN
#0      _JsonStringifier.writeObject (dart:convert/json.dart:793)
#1      _JsonStringifier.writeMap (dart:convert/json.dart:874)
#2      _JsonStringifier.writeJsonValue (dart:convert/json.dart:829)
#3      _JsonStringifier.writeObject (dart:convert/json.dart:784)
#4      _JsonStringifier.writeList (dart:convert/json.dart:844)
#5      _JsonStringifier.writeJsonValue (dart:convert/json.dart:823)
#6      _JsonStringifier.writeObject (dart:convert/json.dart:784)
#7      _JsonStringifier.writeMap (dart:convert/json.dart:874)
#8      _JsonStringifier.writeJsonValue (dart:convert/json.dart:829)
#9      _JsonStringifier.writeObject (dart:convert/json.dart:784)
#10     _JsonStringifier.writeList (dart:convert/json.dart:844)
#11     _JsonStringifier.writeJsonValue (dart:convert/json.dart:823)
#12     _JsonStringifier.writeObject (dart:convert/json.dart:784)
#13     _JsonStringifier.writeMap (dart:convert/json.dart:874)
#14     _JsonStringifier.writeJsonValue (dart:convert/json.dart:829)
#15     _JsonStringifier.writeObject (dart:convert/json.dart:784)
#16     _JsonStringifier.writeList (dart:convert/json.dart:841)
#17     _JsonStringifier.writeJsonValue (dart:convert/json.dart:823)
#18     _JsonStringifier.writeObject (dart:convert/json.dart:784)
#19     _JsonStringifier.writeMap (dart:convert/json.dart:874)
#20     _JsonStringifier.writeJsonValue (dart:convert/json.dart:829)
#21     _JsonStringifier.writeObject (dart:convert/json.dart:784)
#22     _JsonStringStringifier.printOn (dart:convert/json.dart:982)
#23     _JsonStringStringifier.stringify (dart:convert/json.dart:967)
#24     JsonEncoder.convert (dart:convert/json.dart:345)
#25     JsonCodec.encode (dart:convert/json.dart:231)
#26     jsonEncode (dart:convert/json.dart:114)
#27     _encodePage (package:butterfly/bloc/document_state.dart:62)
#28     compute.<anonymous closure> (package:flutter/src/foundation/_isolates_io.dart:19)
#29     _RemoteRunner._run (dart:isolate:1098)
#30     _RemoteRunner._remoteExecute (dart:isolate:1092)
#31     _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:300)
#32     _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:184)

@Lygaen
Copy link

Lygaen commented Jan 17, 2025

Same thing here ! Working fine in other apps,
The stylus is in and on itself working because I can select stuff, just not draw (and erase ?) with it.

[ERROR:flutter/runtime/dart_vm_initializer.cc(40)] Unhandled Exception: Converting object to an encodable object failed: NaN
#0      _JsonStringifier.writeObject (dart:convert/json.dart:793)
#1      _JsonStringifier.writeMap (dart:convert/json.dart:874)
#2      _JsonStringifier.writeJsonValue (dart:convert/json.dart:829)
#3      _JsonStringifier.writeObject (dart:convert/json.dart:784)
#4      _JsonStringifier.writeList (dart:convert/json.dart:844)
#5      _JsonStringifier.writeJsonValue (dart:convert/json.dart:823)
#6      _JsonStringifier.writeObject (dart:convert/json.dart:784)
#7      _JsonStringifier.writeMap (dart:convert/json.dart:874)
#8      _JsonStringifier.writeJsonValue (dart:convert/json.dart:829)
#9      _JsonStringifier.writeObject (dart:convert/json.dart:784)
#10     _JsonStringifier.writeList (dart:convert/json.dart:841)
#11     _JsonStringifier.writeJsonValue (dart:convert/json.dart:823)
#12     _JsonStringifier.writeObject (dart:convert/json.dart:784)
#13     _JsonStringifier.writeMap (dart:convert/json.dart:874)
#14     _JsonStringifier.writeJsonValue (dart:convert/json.dart:829)
#15     _JsonStringifier.writeObject (dart:convert/json.dart:784)
#16     _JsonStringifier.writeList (dart:convert/json.dart:841)
#17     _JsonStringifier.writeJsonValue (dart:convert/json.dart:823)
#18     _JsonStringifier.writeObject (dart:convert/json.dart:784)
#19     _JsonStringifier.writeMap (dart:convert/json.dart:874)
#20     _JsonStringifier.writeJsonValue (dart:convert/json.dart:829)
#21     _JsonStringifier.writeObject (dart:convert/json.dart:784)
#22     _JsonStringStringifier.printOn (dart:convert/json.dart:982)
#23     _JsonStringStringifier.stringify (dart:convert/json.dart:967)
#24     JsonEncoder.convert (dart:convert/json.dart:345)
#25     JsonCodec.encode (dart:convert/json.dart:231)
#26     jsonEncode (dart:convert/json.dart:114)
#27     _encodePage (package:butterfly/bloc/document_state.dart:62)
#28     compute.<anonymous closure> (package:flutter/src/foundation/_isolates_io.dart:19)
#29     _RemoteRunner._run (dart:isolate:1098)
#30     _RemoteRunner._remoteExecute (dart:isolate:1092)
#31     _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:300)
#32     _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:184)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working confirmed
Projects
Archived in project
Development

No branches or pull requests

5 participants