def __init__(self, info=None, path=None, vendor_id=None, product_id=None,<EOL>serial_number=None, blocking=True):
if info is not None:<EOL><INDENT>self._device = hidapi.hid_open_path(info.path)<EOL><DEDENT>elif path is not None:<EOL><INDENT>self._device = hidapi.hid_open_path(path)<EOL><DEDENT>elif not (vendor_id is None or product_id is None):<EOL><INDENT>self._device = hidapi.hid_open(vendor_id, product_id,<EOL>serial_number or ffi.NULL)<EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>if self._device == ffi.NULL:<EOL><INDENT>raise IOError("<STR_LIT>")<EOL><DEDENT>if not blocking:<EOL><INDENT>hidapi.hid_set_nonblocking(self._device, <NUM_LIT:1>)<EOL><DEDENT>
Open a connection to a HID device.
        This can be done either from a DeviceInfo object, a device path or
        a combination of vendor id, product id and an optional serial number.
        If no serial number is passed, the first matching device will be
        selected.
        By setting :param blocking: to True, all reads will be blocking by
        default, otherwise they will return `None` if no data is available.

        :param info:        Information about the device to initialize
        :type info:         DeviceInfo
        :param path:        Platform-specific path to the device (e.g.
                            `/dev/hidraw0` on Linux)
        :type path:         str
        :param vendor_id:   Vendor ID
        :type vendor_id:    int
        :param product_id:  Product ID
        :type product_id:   int
        :param serial_number: Device serial number
        :type serial_number: str
        :param blocking:    Enable blocking reads by default
        :type blocking:     boolean