diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2009-11-10 11:24:15 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2009-11-10 11:24:15 +0000 |
commit | 5de364163f5a7597ba2f54e37cdea493fbd1e7ff (patch) | |
tree | 5fcd9f4c88696ea32d7bdec6721e8243d49567ca /LUFA/Drivers/USB/Class/Device/CDC.c | |
parent | c1782ac024a42c06680f511c939e653aacdb411d (diff) | |
download | lufa-5de364163f5a7597ba2f54e37cdea493fbd1e7ff.tar.gz lufa-5de364163f5a7597ba2f54e37cdea493fbd1e7ff.tar.bz2 lufa-5de364163f5a7597ba2f54e37cdea493fbd1e7ff.zip |
Update CDC Class Driver character stream functions to use the correct avr-libc return codes for errors and EOF.
Fix pointer arithmetic on void byte buffers by explicitly typecasting the buffer pointers to uint8_t* before altering them.
Diffstat (limited to 'LUFA/Drivers/USB/Class/Device/CDC.c')
-rw-r--r-- | LUFA/Drivers/USB/Class/Device/CDC.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/LUFA/Drivers/USB/Class/Device/CDC.c b/LUFA/Drivers/USB/Class/Device/CDC.c index d0cb29ecf..c86b970a3 100644 --- a/LUFA/Drivers/USB/Class/Device/CDC.c +++ b/LUFA/Drivers/USB/Class/Device/CDC.c @@ -242,14 +242,13 @@ void CDC_Device_CreateStream(USB_ClassInfo_CDC_Device_t* CDCInterfaceInfo, FILE* static int CDC_Device_putchar(char c, FILE* Stream)
{
- CDC_Device_SendByte((USB_ClassInfo_CDC_Device_t*)fdev_get_udata(Stream), c);
- return 0;
+ return CDC_Device_SendByte((USB_ClassInfo_CDC_Device_t*)fdev_get_udata(Stream), c) ? _FDEV_ERR : 0;
}
static int CDC_Device_getchar(FILE* Stream)
{
if (!(CDC_Device_BytesReceived((USB_ClassInfo_CDC_Device_t*)fdev_get_udata(Stream))))
- return -1;
+ return _FDEV_EOF;
return CDC_Device_ReceiveByte((USB_ClassInfo_CDC_Device_t*)fdev_get_udata(Stream));
}
|