user space i2c driver for adxl345 with BBB

Before I start, lets see two useless things. This post is not about learning but how checking if adxl chip works. My ADXL345 chip schematic This is the chip Why I use this, because I searched beforehand for which accelerometer chip I will have lots of tutorials on internet. After I am able to check if the chip works, I will go for device tree overlay to make it work on boot. Below is bad and useless code which I thought is useful. /* * Simple I2C example * * Copyright 2017 Joel Stanley <joel@jms.id.au> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. */ #include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <err.h> #include <errno.h> #include <linux/...