Пример #1
0
static int  		print_keysym(int *key, int state, int *lockers, int socket)
{
	static int		modifier = 0;
	int				code;
	int 			type;
	int 			value;

	code = key[modifier];
	type = KTYP(code);
	value = KVAL(code);
	if (type >= syms_size) {
		code = code ^ 0xf000;
		if (code < 0)
			return dprintf(socket, "<(null)>");
		if (code < 0x80)
			return dprintf(socket, "%s", iso646_syms[code]);
		return dprintf(socket, "[%#04x]", code);
	}
	if (type == KT_LETTER)
		type = KT_LATIN;
	if (type < syms_size && value < syms[type].size) {
		if (type == KT_SHIFT)
			return shift_handler(value, state, &modifier);
		if (type == KT_LOCK)
			return lock_handler(value, state, &modifier, lockers);
		if (state)
			return dprintf(socket, "%s", syms[type].table[value]);
	}
	if (type == KT_META && value < syms[0].size)
		return dprintf(socket, "<Meta_%s>", syms[0].table[value]);
	if (state)
		return dprintf(socket, "[%#04x]", code);
	return 1;
}
Пример #2
0
static inline int lock_amba_slot(uint16_t slot, amba_dev_t *dev,
					bool is_ahb, bool is_master) {
	LOCK_SLOT lock_handler;
	if (!is_ahb) {
		lock_handler = lock_apb_slot;
	} else if (!is_master) {
		lock_handler = lock_ahbsl_slot;
	} else {
		lock_handler = lock_ahbm_slot;
	}
	return (-1 == lock_handler(slot, dev)) ? -1 : 0;
}