diff options
author | Stefan Sperling <stsp@cvs.openbsd.org> | 2015-12-18 19:43:15 +0000 |
---|---|---|
committer | Stefan Sperling <stsp@cvs.openbsd.org> | 2015-12-18 19:43:15 +0000 |
commit | 62b747e6c5988496b9cd1f91a762a79b8dfbba93 (patch) | |
tree | 7168fe6ea4aea6725517bb9f66cb38c691a10967 /sys/dev/usb | |
parent | 0a612651b380aa2bf93d8a9ed80460a481a28ec3 (diff) |
Fix urtw(4) on big-endian architectures. Patch by Cedric Tessier.
Tested by Cedric on macppc/i386, and by myself on macppc.
Diffstat (limited to 'sys/dev/usb')
-rw-r--r-- | sys/dev/usb/if_urtw.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/dev/usb/if_urtw.c b/sys/dev/usb/if_urtw.c index b56b9e9942c..aa559936e1a 100644 --- a/sys/dev/usb/if_urtw.c +++ b/sys/dev/usb/if_urtw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_urtw.c,v 1.60 2015/11/25 03:10:00 dlg Exp $ */ +/* $OpenBSD: if_urtw.c,v 1.61 2015/12/18 19:43:14 stsp Exp $ */ /*- * Copyright (c) 2009 Martynas Venckus <martynas@openbsd.org> @@ -1078,6 +1078,7 @@ urtw_8225_write_s16(struct urtw_softc *sc, uint8_t addr, int index, USETW(req.wIndex, index); USETW(req.wLength, sizeof(uint16_t)); + data = htole16(data); return (usbd_do_request(sc->sc_udev, &req, &data)); } @@ -1587,6 +1588,7 @@ urtw_read16_c(struct urtw_softc *sc, int val, uint16_t *data, uint8_t idx) USETW(req.wLength, sizeof(uint16_t)); error = usbd_do_request(sc->sc_udev, &req, data); + *data = letoh16(*data); return (error); } @@ -1603,6 +1605,7 @@ urtw_read32_c(struct urtw_softc *sc, int val, uint32_t *data, uint8_t idx) USETW(req.wLength, sizeof(uint32_t)); error = usbd_do_request(sc->sc_udev, &req, data); + *data = letoh32(*data); return (error); } @@ -1645,6 +1648,7 @@ urtw_write16_c(struct urtw_softc *sc, int val, uint16_t data, uint8_t idx) USETW(req.wIndex, idx & 0x03); USETW(req.wLength, sizeof(uint16_t)); + data = htole16(data); return (usbd_do_request(sc->sc_udev, &req, &data)); } @@ -1659,6 +1663,7 @@ urtw_write32_c(struct urtw_softc *sc, int val, uint32_t data, uint8_t idx) USETW(req.wIndex, idx & 0x03); USETW(req.wLength, sizeof(uint32_t)); + data = htole32(data); return (usbd_do_request(sc->sc_udev, &req, &data)); } |