# contributed by:
#	Kipp Cannon <kipp|gravity.phys.uwm.edu>
#
# brand:
#	Philips
# model no. of remote control:
#	KW-1009/01
# devices being controlled by this remote:
#	Computer
#
# Notes:
# This is an IR keyboard using the 12-bit version of the Philips RC-MM
# protocol.  The first 2 bits are the mode, followed by 2 address bits.
# This keyboard generates "keyboard" mode (10) codes for keyboard and mouse
# buttons, and "mouse" mode (01) codes for the mouse thingy.  The
# keyboard's address bits are 00.  I have combined the mode and address
# bits into a 4-bit pre_data thingy for LIRC.  Each key has a "_DN" version
# and an "_UP" version for the codes generated when the key is pressed, and
# released respectively.  The names have been chosen to match those printed
# by xmodmap.
#
# For the mouse pad, the 8 bits of data are divided up as follows.  The low
# 4 bits encode the direction in which the wheel is being pressed, by
# indicating the angle as measured in the standard sense (0 to the right,
# increasing counter clockwise).  The high 4 bits encode the magnitude of
# the press.  I have not bothered entering codes for the mouse, because
# LIRC isn't really the right way to handle this.
#
# Official timings from Philips documentation (microseconds):
#	header	417	278
#	zero	167	278
#	one	167	444
#	two	167	611
#	three	167	778
#	ptrail	167
#
# The timings below were obtained by collecting a great number of
# statistics, and allow me to use the keyboard with it aimed at the
# computer *and* while sitting facing away from the computer bouncing the
# light off a wall.

begin remote
	name	PHILIPS-KW-1009-01-KEYBOARD
	flags	RCMM|CONST_LENGTH
	aeps	75

	frequency	36000
	header	480	228
	zero	216	228
	one	216	395
	two	216	559
	three	216	726
	ptrail	216
	gap	27497

	bits	8
	pre_data_bits	4
	pre_data	0x8

	begin codes
		Escape_DN       0x01
		F1_DN           0x02
		F2_DN           0x03
		F3_DN           0x04
		F4_DN           0x05
		F5_DN           0x06
		F6_DN           0x07
		F7_DN           0x08
		F8_DN           0x09
		F9_DN           0x0A
		F10_DN          0x0B
		grave_DN        0x14
		1_DN            0x15
		2_DN            0x16
		3_DN            0x17
		4_DN            0x18
		5_DN            0x19
		6_DN            0x1A
		7_DN            0x1B
		8_DN            0x1C
		9_DN            0x1D
		0_DN            0x1E
		minus_DN        0x1F
		equal_DN        0x20
		BackSpace_DN    0x21
		Tab_DN          0x22
		q_DN            0x23
		w_DN            0x24
		e_DN            0x25
		r_DN            0x26
		t_DN            0x27
		y_DN            0x28
		u_DN            0x29
		i_DN            0x2A
		o_DN            0x2B
		p_DN            0x2C
		bracketleft_DN  0x2D
		bracketright_DN 0x2E
		backslash_DN    0x2F
		Caps_Lock_DN    0x30
		a_DN            0x31
		s_DN            0x32
		d_DN            0x33
		f_DN            0x34
		g_DN            0x35
		h_DN            0x36
		j_DN            0x37
		k_DN            0x38
		l_DN            0x39
		semicolon_DN    0x3A
		apostrophe_DN   0x3B
		Return_DN       0x3C
		Shift_L_DN      0x3D
		z_DN            0x3E
		x_DN            0x3F
		c_DN            0x40
		v_DN            0x41
		b_DN            0x42
		n_DN            0x43
		m_DN            0x44
		comma_DN        0x45
		period_DN       0x46
		slash_DN        0x47
		Shift_R_DN      0x48
		FN_DN           0x49
		Control_L_DN    0x4A
		WINDOWS_DN      0x4B
		Alt_L_DN        0x4C
		space_DN        0x4D
		Alt_R_DN        0x4E
		Menu_DN         0x50
		Print_DN        0x52
		Scroll_Lock_DN  0x53
		Pause_DN        0x54
		Insert_DN       0x55
		Delete_DN       0x58
		Up_DN           0x5F
		Left_DN         0x61
		Down_DN         0x62
		Right_DN        0x63
		Num_Lock_DN     0x64
		Mouse_R_DN      0x7E
		Mouse_L_DN      0x7F
		Escape_UP       0x81
		F1_UP           0x82
		F2_UP           0x83
		F3_UP           0x84
		F4_UP           0x85
		F5_UP           0x86
		F6_UP           0x87
		F7_UP           0x88
		F8_UP           0x89
		F9_UP           0x8A
		F10_UP          0x8B
		grave_UP        0x94
		1_UP            0x95
		2_UP            0x96
		3_UP            0x97
		4_UP            0x98
		5_UP            0x99
		6_UP            0x9A
		7_UP            0x9B
		8_UP            0x9C
		9_UP            0x9D
		0_UP            0x9E
		minus_UP        0x9F
		equal_UP        0xA0
		BackSpace_UP    0xA1
		Tab_UP          0xA2
		q_UP            0xA3
		w_UP            0xA4
		e_UP            0xA5
		r_UP            0xA6
		t_UP            0xA7
		y_UP            0xA8
		u_UP            0xA9
		i_UP            0xAA
		o_UP            0xAB
		p_UP            0xAC
		bracketleft_UP  0xAD
		bracketright_UP 0xAE
		backslash_UP    0xAF
		Caps_Lock_UP    0xB0
		a_UP            0xB1
		s_UP            0xB2
		d_UP            0xB3
		f_UP            0xB4
		g_UP            0xB5
		h_UP            0xB6
		j_UP            0xB7
		k_UP            0xB8
		l_UP            0xB9
		semicolon_UP    0xBA
		apostrophe_UP   0xBB
		Return_UP       0xBC
		Shift_L_UP      0xBD
		z_UP            0xBE
		x_UP            0xBF
		c_UP            0xC0
		v_UP            0xC1
		b_UP            0xC2
		n_UP            0xC3
		m_UP            0xC4
		comma_UP        0xC5
		period_UP       0xC6
		slash_UP        0xC7
		Shift_R_UP      0xC8
		FN_UP           0xC9
		Control_L_UP    0xCA
		WINDOWS_UP      0xCB
		Alt_L_UP        0xCC
		space_UP        0xCD
		Alt_R_UP        0xCE
		Menu_UP         0xD0
		Print_UP        0xD2
		Scroll_Lock_UP  0xD3
		Pause_UP        0xD4
		Insert_UP       0xD5
		Delete_UP       0xD8
		Up_UP           0xDF
		Left_UP         0xE1
		Down_UP         0xE2
		Right_UP        0xE3
		Num_Lock_UP     0xE4
		Mouse_R_UP      0xFE
		Mouse_L_UP      0xFF
	end codes
end remote

begin remote
	name	PHILIPS-KW-1009-01-MOUSE
	flags	RCMM|CONST_LENGTH
	aeps	75

	frequency	36000
	header	480	228
	zero	216	228
	one	216	395
	two	216	559
	three	216	726
	ptrail	216
	gap	27497

	bits	8
	pre_data_bits	4
	pre_data	0x4

	begin codes
	end codes
end remote
