/* convert an IE from Gigaset hex string to ETSI binary representation including length byte return value: result length, -1 on error  */
static int encode_ie(char *in, u8 *out, int maxlen)
/* convert an IE from Gigaset hex string to ETSI binary representation including length byte return value: result length, -1 on error  */
static int encode_ie(char *in, u8 *out, int maxlen)
{
	int l = 0;
	while (*in) {
		if (!ishexdigit(in[0]) || !ishexdigit(in[1]) || l >= maxlen)
			return -1;
		out[++l] = (hex2bin(in[0]) << 4) + hex2bin(in[1]);
		in += 2;
	}
	out[0] = l;
	return l;
}