public void recieveCmd(){
		int cmd;
		try {
			cmd = input.read();
		} catch (IOException ioe) {
			System.out.println("failed to read from serial");
			ioe.printStackTrace();
			return;
		}
		System.out.printf("cmd = %x: ", cmd);
		if((cmd & 0x80) == 0) return;
		switch(cmd){
		case 0xC0: // start left click
			System.out.println("left click");
			r.mousePress(InputEvent.BUTTON1_MASK);
			break;
		case 0xC1: // end left click
			System.out.println("left release");
			r.mouseRelease(InputEvent.BUTTON1_MASK);
			break;
		case 0xC2: // start right click
			System.out.println("right click");
			r.mousePress(InputEvent.BUTTON3_MASK);
			break;
		case 0xC3: // end right click
			System.out.println("right release");
			r.mouseRelease(InputEvent.BUTTON3_MASK);
			break;
		case 0x80: // move mouse
			int[] xy = readXY(false);
			xy = mapXY(xy);
			r.mouseMove(xy[0], xy[1]);
			System.out.printf("move to (%d, %d)\n", xy[0], xy[1]);
			break;
		case 0xF0: // set keyboard modifiers
			setModifiersWithRobot();
			break;
		default:
			System.out.printf("undefined: %x\n");
		}
	}