require '_h2ph_pre.ph';

no warnings qw(redefine misc);

unless(defined(&_DEV_USB_USBHID_H_)) {
    eval 'sub _DEV_USB_USBHID_H_ () {1;}' unless defined(&_DEV_USB_USBHID_H_);
    require 'dev/hid/hid.ph';
    require 'sys/ioccom.ph';
    eval 'sub UR_GET_HID_DESCRIPTOR () {0x6;}' unless defined(&UR_GET_HID_DESCRIPTOR);
    eval 'sub UDESC_HID () {0x21;}' unless defined(&UDESC_HID);
    eval 'sub UDESC_REPORT () {0x22;}' unless defined(&UDESC_REPORT);
    eval 'sub UDESC_PHYSICAL () {0x23;}' unless defined(&UDESC_PHYSICAL);
    eval 'sub UR_SET_HID_DESCRIPTOR () {0x7;}' unless defined(&UR_SET_HID_DESCRIPTOR);
    eval 'sub UR_GET_REPORT () {0x1;}' unless defined(&UR_GET_REPORT);
    eval 'sub UR_SET_REPORT () {0x9;}' unless defined(&UR_SET_REPORT);
    eval 'sub UR_GET_IDLE () {0x2;}' unless defined(&UR_GET_IDLE);
    eval 'sub UR_SET_IDLE () {0xa;}' unless defined(&UR_SET_IDLE);
    eval 'sub UR_GET_PROTOCOL () {0x3;}' unless defined(&UR_GET_PROTOCOL);
    eval 'sub UR_SET_PROTOCOL () {0xb;}' unless defined(&UR_SET_PROTOCOL);
    eval 'sub USB_HID_DESCRIPTOR_SIZE {
        my($n) = @_;
	    eval q((9+($n)*3));
    }' unless defined(&USB_HID_DESCRIPTOR_SIZE);
    eval 'sub UHID_INPUT_REPORT () {0x1;}' unless defined(&UHID_INPUT_REPORT);
    eval 'sub UHID_OUTPUT_REPORT () {0x2;}' unless defined(&UHID_OUTPUT_REPORT);
    eval 'sub UHID_FEATURE_REPORT () {0x3;}' unless defined(&UHID_FEATURE_REPORT);
    eval 'sub USB_HID_GET_RAW () { &_IOR(ord(\'h\'), 1, \'int\');}' unless defined(&USB_HID_GET_RAW);
    eval 'sub USB_HID_SET_RAW () { &_IOW(ord(\'h\'), 2, \'int\');}' unless defined(&USB_HID_SET_RAW);
}
1;
