New send_mouse. Flag=0 to move to xy. Flag=1 for button clicks.
Code:
int send_mouse(int x,int y,char but,int flag) { unsigned char buf[5]; int x0,y0; static int reportindex = -1; static int lastx = 0; static int lasty = 0; if(flag == 0) // new xy { x0 = x; y0 = y; lastx = x; lasty = y; } else // flag=1 button click - use last xy { x0 = lastx; y0 = lasty; } if(reportindex < 0) { // look up Report 1 index buf[0] = 0x2A; buf[1] = 0x4D; reportindex = find_ctic_index(localnode(),UUID_2,buf); if(reportindex < 0) { printf("Failed to find Report characteristic\n"); return(0); } ++reportindex; // Mouse is Report 2 } buf[0] = but; buf[1] = x0 & 0xFF; buf[2] = (x0 >> 8) & 0xFF; buf[3] = y0 & 0xFF; buf[4] = (y0 >> 8) & 0xFF; // send to Report2 write_ctic(localnode(),reportindex,buf,5); return(1); }Statistics: Posted by petzval — Wed Apr 02, 2025 11:32 am