AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题 / 1273063
Accepted
Parth Shah
Parth Shah
Asked: 2020-09-07 04:57:57 +0800 CST2020-09-07 04:57:57 +0800 CST 2020-09-07 04:57:57 +0800 CST

戴尔有源笔 PN350M 无法正常工作

  • 772

我在 Dell Inspiron 15 7591 2 合 1 上运行 Ubuntu 20.04。笔记本电脑配有手写笔,戴尔 PN350M 有源笔,不幸的是,它在我的系统下无法正常工作。我发现笔使用 Microsoft Pen 协议与我的设备配对。以下是一些可能有助于解决此问题的输出。

我发现它sudo evtest完美地显示了压力读数,但xinput --test根本不显示压力读数,并且尖端被视为按钮 1。

sudo evtest
[sudo] password for parth: 
No device specified, trying to scan all of /dev/input/event*
Available devices:
/dev/input/event0:  Lid Switch
/dev/input/event1:  Power Button
/dev/input/event2:  Sleep Button
/dev/input/event3:  AT Translated Set 2 keyboard
/dev/input/event4:  Integrated_Webcam_HD: Integrate
/dev/input/event5:  DELL0908:00 04F3:30E3 Mouse
/dev/input/event6:  Dell WMI hotkeys
/dev/input/event7:  Intel HID events
/dev/input/event8:  Intel HID 5 button array
/dev/input/event9:  PS/2 Generic Mouse
/dev/input/event10: 2.4G Mouse
/dev/input/event11: 2.4G Mouse
/dev/input/event12: DELL0908:00 04F3:30E3 Touchpad
/dev/input/event13: Video Bus
/dev/input/event14: Video Bus
/dev/input/event15: CUST0000:00 27C6:0118
/dev/input/event16: CUST0000:00 27C6:0118 Stylus
/dev/input/event17: CUST0000:00 27C6:0118 UNKNOWN
/dev/input/event18: sof-hda-dsp Headphone Mic
/dev/input/event19: sof-hda-dsp HDMI/DP,pcm=3
/dev/input/event20: sof-hda-dsp HDMI/DP,pcm=4
/dev/input/event21: sof-hda-dsp HDMI/DP,pcm=5
Select the device event number [0-21]: 16
Input driver version is 1.0.1
Input device ID: bus 0x18 vendor 0x27c6 product 0x118 version 0x100
Input device name: "CUST0000:00 27C6:0118 Stylus"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
  Event type 3 (EV_ABS)
    Event code 47 (ABS_MT_SLOT)
      Value      0
      Min        0
      Max        9
    Event code 53 (ABS_MT_POSITION_X)
      Value      0
      Min        0
      Max     5760
      Resolution      17
    Event code 54 (ABS_MT_POSITION_Y)
      Value      0
      Min        0
      Max     3240
      Resolution      17
    Event code 57 (ABS_MT_TRACKING_ID)
      Value      0
      Min        0
      Max    65535
    Event code 58 (ABS_MT_PRESSURE)
      Value      0
      Min        0
      Max     1023
    Event code 59 (ABS_MT_DISTANCE)
      Value      0
      Min        0
      Max        1
Properties:
  Property type 1 (INPUT_PROP_DIRECT)
Testing ... (interrupt to exit)
Event: time 1599396868.187587, type 3 (EV_ABS), code 57 (ABS_MT_TRACKING_ID), value 43
Event: time 1599396868.187587, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 3767
Event: time 1599396868.187587, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 1597
Event: time 1599396868.187587, -------------- SYN_REPORT ------------
Event: time 1599396868.189591, type 3 (EV_ABS), code 59 (ABS_MT_DISTANCE), value 0
Event: time 1599396868.189591, type 3 (EV_ABS), code 58 (ABS_MT_PRESSURE), value 11
Event: time 1599396868.189591, -------------- SYN_REPORT ------------
xinput --test 15
motion a[0]=44467 a[1]=32959 
button press   1 a[0]=44467 a[1]=32959 
motion a[0]=44467 a[1]=32939 
motion a[0]=44490 a[1]=32919 
motion a[0]=44501 a[1]=32878 
motion a[0]=44524 a[1]=32858 
motion a[0]=44546 a[1]=32818 
motion a[0]=44592 a[1]=32757 
motion a[0]=44626 a[1]=32716 
motion a[0]=44672 a[1]=32676 
motion a[0]=44717 a[1]=32656 
motion a[0]=44774 a[1]=32615 
motion a[0]=44831 a[1]=32595 
motion a[0]=44888 a[1]=32575 
motion a[0]=44956 a[1]=32575 
motion a[0]=45013 a[1]=32575 
motion a[0]=45070 a[1]=32575 
motion a[0]=45127 a[1]=32555 
motion a[0]=45195 a[1]=32555 
motion a[0]=45252 a[1]=32534 
motion a[0]=45309 a[1]=32514 
motion a[0]=45366 a[1]=32494 
motion a[0]=45422 a[1]=32454 
motion a[0]=45491 a[1]=32433 
motion a[0]=45548 a[1]=32413 
motion a[0]=45616 a[1]=32393 
motion a[0]=45695 a[1]=32373 
motion a[0]=45775 a[1]=32332 
motion a[0]=45832 a[1]=32312 
motion a[0]=45877 a[1]=32292 
motion a[0]=45912 a[1]=32292 
motion a[0]=45934 a[1]=32272 
motion a[0]=45934 a[1]=32251 
motion a[0]=45946 a[1]=32231 
motion a[0]=45946 a[1]=32211 
motion a[0]=45946 a[1]=32191 
motion a[0]=45957 a[1]=32150 
motion a[0]=45957 a[1]=32110 
motion a[0]=45968 a[1]=32049 
motion a[0]=45980 a[1]=32009 
motion a[0]=45991 a[1]=31928 
motion a[0]=46048 a[1]=31665 
motion a[0]=46037 a[1]=31705 
motion a[0]=46105 a[1]=31422 
motion a[0]=46094 a[1]=31443 
motion a[0]=46105 a[1]=31402 
motion a[0]=46116 a[1]=31341 
motion a[0]=46116 a[1]=31341 
button release 1 a[0]=46116 a[1]=31341

任何帮助,将不胜感激!

dell stylus evdev input xinput
  • 1 1 个回答
  • 1459 Views

1 个回答

  • Voted
  1. Best Answer
    Parth Shah
    2021-06-16T11:45:16+08:002021-06-16T11:45:16+08:00

    我设法使用 evdev 和 libevdev 库创建了一个 python 驱动程序。我正在创建一个虚拟设备,然后简单地传递我从手写笔找到的事件。它正在处理压力事件和跟踪,但是我无法让按钮工作。

    只需复制它并将其标记为可执行文件,您就会看到一个名为“Custom Stylus”的设备应该可以工作。为了使它无缝,我将它添加到 ,gnome-session-properties以便它在启动时运行脚本。

    希望这可以帮助!

    #!/usr/bin/env python3
    import sys
    import libevdev
    import time
    import evdev
    from evdev import UInput, AbsInfo, ecodes
    import os
    
    
    def main(args):
        p = 0
        i = 0
        devices = evdev.list_devices()
    
        for dev in devices:
            # print('%-12i%s' % (p, evdev.InputDevice(dev).name))
            if evdev.InputDevice(dev).name == 'CUST0000:00 27C6:0118 Stylus':
                i = p
            p += 1
    
        # i=int(input("Enter number: "))
    
        device = evdev.InputDevice(devices[i])
    
        print(device)
    
        # print(mouse.capabilities(verbose=True))
    
        device.grab()
    
        x, y = 0, 0
    
        dev = libevdev.Device()
        dev.name = "Custom Stylus"
    
        dev.enable(libevdev.INPUT_PROP_DIRECT)
        dev.enable(libevdev.EV_KEY.BTN_TOOL_PEN)
        dev.enable(libevdev.EV_KEY.BTN_TOOL_RUBBER)
        # Click
        dev.enable(libevdev.EV_KEY.BTN_TOUCH)
        # Press button 1 on pen
        dev.enable(libevdev.EV_KEY.BTN_STYLUS)
        # Press button 2 on pen, see great doc
        dev.enable(libevdev.EV_KEY.BTN_STYLUS2)
        # Send absolute X coordinate
        dev.enable(libevdev.EV_ABS.ABS_X,
                   libevdev.InputAbsInfo(minimum=0, maximum=5760, resolution=17))
        # Send absolute Y coordinate
        dev.enable(libevdev.EV_ABS.ABS_Y,
                   libevdev.InputAbsInfo(minimum=0, maximum=3240, resolution=17))
        # Send absolute pressure
        dev.enable(libevdev.EV_ABS.ABS_PRESSURE,
                   libevdev.InputAbsInfo(minimum=0, maximum=1023))
        dev.enable(libevdev.EV_SYN.SYN_REPORT)
        dev.enable(libevdev.EV_SYN.SYN_DROPPED)
        try:
            uinput = dev.create_uinput_device()
            print("New device at {} ({})".format(uinput.devnode, uinput.syspath))
            # Sleep for a bit so udev, libinput, Xorg, Wayland, ...
            # all have had a chance to see the device and initialize
            # it. Otherwise the event will be sent by the kernel but
            # nothing is ready to listen to the device yet. And it
            # will never be detected in the futur ;-)
            time.sleep(1)
            # Reports that the PEN is close to the surface
            # Important to make sure xinput can detect (and list)
            # the pen. Otherwise, it won't write anything in gimp.
            uinput.send_events([
                libevdev.InputEvent(libevdev.EV_KEY.BTN_TOUCH,
                                    value=0),
                libevdev.InputEvent(libevdev.EV_KEY.BTN_TOOL_PEN,
                                    value=1),
                libevdev.InputEvent(libevdev.EV_SYN.SYN_REPORT,
                                    value=0),
            ])
            # Says that the pen it out of range of the tablet. Useful
            # to make sure you can move your mouse, and to avoid
            # strange things during the first draw.
            uinput.send_events([
                libevdev.InputEvent(libevdev.EV_KEY.BTN_TOUCH,
                                    value=0),
                libevdev.InputEvent(libevdev.EV_KEY.BTN_TOOL_PEN,
                                    value=0),
                libevdev.InputEvent(libevdev.EV_SYN.SYN_REPORT,
                                    value=0),
            ])
    
            for event in device.read_loop():
                code, val = event.code, event.value
    
                if code == ecodes.ABS_MT_POSITION_X:
                    uinput.send_events([
                        libevdev.InputEvent(libevdev.EV_ABS.ABS_X,
                                            value=int(val)),
                        libevdev.InputEvent(libevdev.EV_KEY.BTN_TOUCH,
                                            value=1),
                        libevdev.InputEvent(libevdev.EV_KEY.BTN_STYLUS,
                                            value=0),
                        libevdev.InputEvent(libevdev.EV_KEY.BTN_STYLUS2,
                                            value=0),
                        libevdev.InputEvent(libevdev.EV_KEY.BTN_TOOL_PEN,
                                            value=1),
                        libevdev.InputEvent(libevdev.EV_SYN.SYN_REPORT,
                                            value=0)])
                    # vpen.write(ecodes.EV_ABS, ecodes.ABS_X, int(val))
    
                if code == ecodes.ABS_MT_POSITION_Y:
                    uinput.send_events([
                        libevdev.InputEvent(libevdev.EV_ABS.ABS_Y,
                                            value=int(val)),
                        libevdev.InputEvent(libevdev.EV_KEY.BTN_TOUCH,
                                            value=1),
                        libevdev.InputEvent(libevdev.EV_KEY.BTN_STYLUS,
                                            value=0),
                        libevdev.InputEvent(libevdev.EV_KEY.BTN_STYLUS2,
                                            value=0),
                        libevdev.InputEvent(libevdev.EV_KEY.BTN_TOOL_PEN,
                                            value=1),
                        libevdev.InputEvent(libevdev.EV_SYN.SYN_REPORT,
                                            value=0)])
    
                if code == ecodes.ABS_MT_PRESSURE:
                    uinput.send_events([
                        libevdev.InputEvent(libevdev.EV_ABS.ABS_PRESSURE,
                                            value=int(val)),
                        libevdev.InputEvent(libevdev.EV_KEY.BTN_TOUCH,
                                            value=1),
                        libevdev.InputEvent(libevdev.EV_KEY.BTN_STYLUS,
                                            value=0),
                        libevdev.InputEvent(libevdev.EV_KEY.BTN_STYLUS2,
                                            value=0),
                        libevdev.InputEvent(libevdev.EV_KEY.BTN_TOOL_PEN,
                                            value=1),
                        libevdev.InputEvent(libevdev.EV_SYN.SYN_REPORT,
                                            value=0)])
    
            device.ungrab()
    
        except KeyboardInterrupt:
            pass
    
    
    if __name__ == "__main__":
        main(sys.argv)
    
    
    • 3

相关问题

  • 如何重新安装声音驱动程序?

  • GMA 5700 MHD Dell Vostro 3300 外接 vga 显示器闪烁

  • 无法暂停 Dell Inspiron [关闭]

  • 有没有办法在显示器断开连接时自动检测?

  • 戴尔 Studio 1537 遥控器与红外接收端口 IT8512 CIR 的工作原理

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve