abcminiuser / lufa

LUFA - the Lightweight USB Framework for AVRs.
http://www.lufa-lib.org
1.04k stars 325 forks source link

CDC Class Driver fputc() return written character #119

Closed NicoHood closed 6 years ago

NicoHood commented 6 years ago

http://www.cplusplus.com/reference/cstdio/fputc/:

On success, the character written is returned.

https://github.com/abcminiuser/lufa/blob/master/LUFA/Drivers/USB/Class/Device/CDCClassDevice.c#L326

static int CDC_Device_putchar(char c,
                              FILE* Stream)
{
    return CDC_Device_SendByte((USB_ClassInfo_CDC_Device_t*)fdev_get_udata(Stream), c) ? _FDEV_ERR : 0;
}

Shouldn't it be _FDEV_ERR : c; then?

abcminiuser commented 6 years ago

Yes, it should. Fixed in 8802907ce274489690f8edf169454f750c8efe57 - thanks!