Decode the IrDA device address as little endian.
This is only a cosmetic change, to make the IrDA device address on Windows consistent with the address Linux. There is no functional difference because the address is always serialized and deserialized internally, and applications shouldn't care about the actual number. Anyway, the difference in endianness is easy to notice because the Uwatec Smart family of devices use the serial number as the IrDA device address. On Linux, the address was identical to the serial number, while on Windows the byte order was reversed.
This commit is contained in:
parent
3d82c5f9cd
commit
456365366c
18
src/irda.c
18
src/irda.c
@ -250,7 +250,7 @@ irda_socket_discover (irda_t *device, irda_callback_t callback, void *userdata)
|
||||
if (callback) {
|
||||
#ifdef _WIN32
|
||||
for (unsigned int i = 0; i < list->numDevice; ++i) {
|
||||
unsigned int address = array_uint32_be (list->Device[i].irdaDeviceID);
|
||||
unsigned int address = array_uint32_le (list->Device[i].irdaDeviceID);
|
||||
unsigned int hints = (list->Device[i].irdaDeviceHints1 << 8) +
|
||||
list->Device[i].irdaDeviceHints2;
|
||||
|
||||
@ -302,10 +302,10 @@ irda_socket_connect_name (irda_t *device, unsigned int address, const char *name
|
||||
#ifdef _WIN32
|
||||
SOCKADDR_IRDA peer;
|
||||
peer.irdaAddressFamily = AF_IRDA;
|
||||
peer.irdaDeviceID[0] = (address >> 24) & 0xFF;
|
||||
peer.irdaDeviceID[1] = (address >> 16) & 0xFF;
|
||||
peer.irdaDeviceID[2] = (address >> 8) & 0xFF;
|
||||
peer.irdaDeviceID[3] = (address ) & 0xFF;
|
||||
peer.irdaDeviceID[0] = (address ) & 0xFF;
|
||||
peer.irdaDeviceID[1] = (address >> 8) & 0xFF;
|
||||
peer.irdaDeviceID[2] = (address >> 16) & 0xFF;
|
||||
peer.irdaDeviceID[3] = (address >> 24) & 0xFF;
|
||||
if (name)
|
||||
strncpy (peer.irdaServiceName, name, 25);
|
||||
else
|
||||
@ -339,10 +339,10 @@ irda_socket_connect_lsap (irda_t *device, unsigned int address, unsigned int lsa
|
||||
#ifdef _WIN32
|
||||
SOCKADDR_IRDA peer;
|
||||
peer.irdaAddressFamily = AF_IRDA;
|
||||
peer.irdaDeviceID[0] = (address >> 24) & 0xFF;
|
||||
peer.irdaDeviceID[1] = (address >> 16) & 0xFF;
|
||||
peer.irdaDeviceID[2] = (address >> 8) & 0xFF;
|
||||
peer.irdaDeviceID[3] = (address ) & 0xFF;
|
||||
peer.irdaDeviceID[0] = (address ) & 0xFF;
|
||||
peer.irdaDeviceID[1] = (address >> 8) & 0xFF;
|
||||
peer.irdaDeviceID[2] = (address >> 16) & 0xFF;
|
||||
peer.irdaDeviceID[3] = (address >> 24) & 0xFF;
|
||||
snprintf (peer.irdaServiceName, 25, "LSAP-SEL%u", lsap);
|
||||
#else
|
||||
struct sockaddr_irda peer;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user