I'd start with sysctl -a | grep '\.wake:'. ACPI devices that are allowed to wake the machine show up there, and setting the one for the keyboard controller (on laptops usually atkbdc0) to 1 is sometimes all it takes. If the keyboard isn't in that list at all, it's likely a firmware thing and you're stuck with the power button and the lid.