Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect Pixelbook Pen button?

I follow the doc here to catch the button pressed on Pixelbook pen while drawing, but the TOOL_TYPE_ERASER event is never thrown. When I tried to print the log, I don't see any differences between holding and release the button:

onTouchEvent:MotionEvent { action=ACTION_DOWN, actionButton=0, id[0]=0, x[0]=2010.4766, y[0]=778.10156, toolType[0]=TOOL_TYPE_STYLUS, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=1395185, downTime=1395185, deviceId=1, source=0x1002 }
2018-09-29 16:15:35.527 2926-2926/com.  onTouchEvent:MotionEvent { action=ACTION_MOVE, actionButton=0, id[0]=0, x[0]=2009.2734, y[0]=777.6406, toolType[0]=TOOL_TYPE_STYLUS, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=4, eventTime=1395195, downTime=1395185, deviceId=1, source=0x1002 }
2018-09-29 16:15:35.552 2926-2926/com.  onTouchEvent:MotionEvent { action=ACTION_MOVE, actionButton=0, id[0]=0, x[0]=2008.0703, y[0]=776.71484, toolType[0]=TOOL_TYPE_STYLUS, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=9, eventTime=1395221, downTime=1395185, deviceId=1, source=0x1002 }
2018-09-29 16:15:35.569 2926-2926/com.  onTouchEvent:MotionEvent { action=ACTION_MOVE, actionButton=0, id[0]=0, x[0]=2007.8867, y[0]=776.25, toolType[0]=TOOL_TYPE_STYLUS, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=3, eventTime=1395238, downTime=1395185, deviceId=1, source=0x1002 }
2018-09-29 16:15:35.594 2926-2926/com.  onTouchEvent:MotionEvent { action=ACTION_MOVE, actionButton=0, id[0]=0, x[0]=2008.0703, y[0]=775.6953, toolType[0]=TOOL_TYPE_STYLUS, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=7, eventTime=1395263, downTime=1395185, deviceId=1, source=0x1002 }
2018-09-29 16:15:35.611 2926-2926/com.  onTouchEvent:MotionEvent { action=ACTION_MOVE, actionButton=0, id[0]=0, x[0]=2008.2578, y[0]=774.58594, toolType[0]=TOOL_TYPE_STYLUS, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=6, eventTime=1395280, downTime=1395185, deviceId=1, source=0x1002 }
2018-09-29 16:15:35.624 2926-2926/com.  onTouchEvent:MotionEvent { action=ACTION_MOVE, actionButton=0, id[0]=0, x[0]=2008.3477, y[0]=773.28906, toolType[0]=TOOL_TYPE_STYLUS, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=5, eventTime=1395295, downTime=1395185, deviceId=1, source=0x1002 }
2018-09-29 16:15:35.624 2926-2926/com.  onTouchEvent:MotionEvent { action=ACTION_UP, actionButton=0, id[0]=0, x[0]=2008.3477, y[0]=773.28906, toolType[0]=TOOL_TYPE_STYLUS, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=1395297, downTime=1395185, deviceId=1, source=0x1002 }
2018-09-29 16:15:42.632 2926-2926/com.  onTouchEvent:MotionEvent { action=ACTION_DOWN, actionButton=0, id[0]=0, x[0]=2018.3477, y[0]=1013.64453, toolType[0]=TOOL_TYPE_STYLUS, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=1402304, downTime=1402304, deviceId=1, source=0x1002 }
2018-09-29 16:15:42.643 2926-2926/com.  onTouchEvent:MotionEvent { action=ACTION_MOVE, actionButton=0, id[0]=0, x[0]=2018.5312, y[0]=1013.64453, toolType[0]=TOOL_TYPE_STYLUS, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=2, eventTime=1402312, downTime=1402304, deviceId=1, source=0x1002 }
2018-09-29 16:15:42.660 2926-2926/com.  onTouchEvent:MotionEvent { action=ACTION_MOVE, actionButton=0, id[0]=0, x[0]=2018.1641, y[0]=1013.5508, toolType[0]=TOOL_TYPE_STYLUS, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=6, eventTime=1402329, downTime=1402304, deviceId=1, source=0x1002 }
2018-09-29 16:15:42.668 2926-2926/com.  onTouchEvent:MotionEvent { action=ACTION_MOVE, actionButton=0, id[0]=0, x[0]=2018.1641, y[0]=1013.46094, toolType[0]=TOOL_TYPE_STYLUS, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=1402337, downTime=1402304, deviceId=1, source=0x1002 }
2018-09-29 16:15:42.669 2926-2926/com.  onTouchEvent:MotionEvent { action=ACTION_UP, actionButton=0, id[0]=0, x[0]=2018.1641, y[0]=1013.46094, toolType[0]=TOOL_TYPE_STYLUS, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=1402342, downTime=1402304, deviceId=1, source=0x1002 }

My Chrome OS version: 69.0.3497.95(official build)(64-bit)

like image 811
thanhbinh84 Avatar asked Nov 07 '22 01:11

thanhbinh84


1 Answers

Google team confirmed that event is occupied by the system, application cannot catch that with the current API.

like image 178
thanhbinh84 Avatar answered Nov 14 '22 08:11

thanhbinh84