IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW_SEPARATE,
 };
 
+enum iio_endian {
+       IIO_CPU,
+       IIO_BE,
+       IIO_LE,
+};
+
 /**
  * struct iio_chan_spec - specification of a single channel
  * @type:              What type of measurement is the channel making.
  *                     storage_bits:   Realbits + padding
  *                     shift:          Shift right by this before masking out
  *                                     realbits.
+ *                     endianness:     little or big endian
  * @info_mask:         What information is to be exported about this channel.
  *                     This includes calibbias, scale etc.
  * @event_mask:        What events can this channel produce.
                u8      realbits;
                u8      storagebits;
                u8      shift;
+               enum iio_endian endianness;
        } scan_type;
        long                    info_mask;
        long                    event_mask;
 
 #include "sysfs.h"
 #include "ring_generic.h"
 
+static const char * const iio_endian_prefix[] = {
+       [IIO_BE] = "be",
+       [IIO_LE] = "le",
+};
 
 /**
  * iio_ring_read_first_n_outer() - chrdev read for ring buffer access
                                   char *buf)
 {
        struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
-       return sprintf(buf, "%c%d/%d>>%u\n",
+       u8 type = this_attr->c->scan_type.endianness;
+
+       if (type == IIO_CPU) {
+               if (__LITTLE_ENDIAN)
+                       type = IIO_LE;
+               else
+                       type = IIO_BE;
+       }
+       return sprintf(buf, "%s:%c%d/%d>>%u\n",
+                      iio_endian_prefix[type],
                       this_attr->c->scan_type.sign,
                       this_attr->c->scan_type.realbits,
                       this_attr->c->scan_type.storagebits,