# 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
		       0x01
		           0x02
		           0x03
		           0x04
		           0x05
		           0x06
		           0x07
		           0x08
		           0x09
		           0x0A
		          0x0B
		        0x14
		            0x15
		            0x16
		            0x17
		            0x18
		            0x19
		            0x1A
		            0x1B
		            0x1C
		            0x1D
		            0x1E
		        0x1F
		        0x20
		    0x21
		          0x22
		            0x23
		            0x24
		            0x25
		            0x26
		            0x27
		            0x28
		            0x29
		            0x2A
		            0x2B
		            0x2C
		  0x2D
		 0x2E
		    0x2F
		    0x30
		            0x31
		            0x32
		            0x33
		            0x34
		            0x35
		            0x36
		            0x37
		            0x38
		            0x39
		    0x3A
		   0x3B
		       0x3C
		      0x3D
		            0x3E
		            0x3F
		            0x40
		            0x41
		            0x42
		            0x43
		            0x44
		        0x45
		       0x46
		        0x47
		      0x48
		           0x49
		    0x4A
		      0x4B
		        0x4C
		        0x4D
		        0x4E
		         0x50
		        0x52
		  0x53
		        0x54
		       0x55
		       0x58
		           0x5F
		         0x61
		         0x62
		        0x63
		     0x64
		      0x7E
		      0x7F
		       0x81
		           0x82
		           0x83
		           0x84
		           0x85
		           0x86
		           0x87
		           0x88
		           0x89
		           0x8A
		          0x8B
		        0x94
		KEY_1            0x95
		KEY_2            0x96
		KEY_3            0x97
		KEY_4            0x98
		KEY_5            0x99
		KEY_6            0x9A
		KEY_7            0x9B
		KEY_8            0x9C
		KEY_9            0x9D
		KEY_0            0x9E
		        0x9F
		        0xA0
		    0xA1
		          0xA2
		            0xA3
		            0xA4
		            0xA5
		            0xA6
		            0xA7
		            0xA8
		            0xA9
		            0xAA
		            0xAB
		            0xAC
		  0xAD
		 0xAE
		    0xAF
		    0xB0
		            0xB1
		            0xB2
		            0xB3
		            0xB4
		            0xB5
		            0xB6
		            0xB7
		            0xB8
		            0xB9
		    0xBA
		   0xBB
		       0xBC
		      0xBD
		            0xBE
		            0xBF
		            0xC0
		            0xC1
		            0xC2
		            0xC3
		            0xC4
		        0xC5
		       0xC6
		        0xC7
		      0xC8
		           0xC9
		    0xCA
		      0xCB
		        0xCC
		        0xCD
		        0xCE
		         0xD0
		        0xD2
		  0xD3
		        0xD4
		       0xD5
		       0xD8
		           0xDF
		         0xE1
		         0xE2
		        0xE3
		     0xE4
		      0xFE
		      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
