FreeBSD/sys/dev/usb/wlan/if_upgt.c
/*
 * While copying the version 2 firmware, we need to replace two characters:
 *
 * 0x7e -> 0x7d 0x5e
 * 0x7d -> 0x7d 0x5d
 */
While copying the version 2 firmware, we need to replace two characters:
0x7e -> 0x7d 0x5e
0x7d -> 0x7d 0x5d
While copying the version 2 firmware we need to replace two characters : 0x7e - > 0x7d 0x5e 0x7d - > 0x7d 0x5d
static int
upgt_fw_copy(const uint8_t *src, char *dst, int size)
{
	int i, j;
	for (i = 0, j = 0; i < size && j < size; i++) {
		switch (src[i]) {
		case 0x7e:
			dst[j] = 0x7d;
			j++;
			dst[j] = 0x5e;
			j++;
			break;
		case 0x7d:
			dst[j] = 0x7d;
			j++;
			dst[j] = 0x5d;
			j++;
			break;
		default:
			dst[j] = src[i];
			j++;
			break;
		}
	}
	return (i);
}
static int upgt_fw_copy ( const uint8_t * src , char * dst , int size ) { int i , j ; for ( i = 0 , j = 0 ; i < size && j < size ; i ++ ) { switch ( src [ i ] ) { case 0x7e : dst [ j ] = 0x7d ; j ++ ; dst [ j ] = 0x5e ; j ++ ; break ; case 0x7d : dst [ j ] = 0x7d ; j ++ ; dst [ j ] = 0x5d ; j ++ ; break ; default : dst [ j ] = src [ i ] ; j ++ ; break ; } } return ( i ) ; }
While copying the version 2 firmware, we need to replace two characters:
 0x7e -> 0x7d 0x5e
 0x7d -> 0x7d 0x5d
While copying the version 2 firmware we need to replace two characters : 0x7e - > 0x7d 0x5e 0x7d - > 0x7d 0x5d