public static void setDescriptor (
	Device dev,
	byte descriptorClass,
	byte descriptorType,
	byte id,
	int index,
	byte buf []
    ) throws IOException
    {
	if (index > 0xffff || buf.length > 0xffff)
	    throw new IllegalArgumentException ();

	ControlMessage	msg = new ControlMessage ();

	msg.setRequestType ((byte)(msg.DIR_TO_DEVICE
				| descriptorClass
				| msg.RECIPIENT_DEVICE
				));
	msg.setRequest (msg.SET_DESCRIPTOR);
	msg.setValue ((short) ((descriptorType << 8) | (0xff & id)));
	msg.setIndex ((short) index);
	msg.setBuffer (buf);
	dev.control (msg);
    }