Coder Social home page Coder Social logo

raspberrypimouse's Introduction

RaspberryPiMouse

CI

This repository has the source code and kernel objects for the Raspberry Pi Mouse.

Installation

Run the installation script (./utils/build_install.bash).

インストール用のシェルスクリプト(./utils/build_install.bash)を実行します。

for Raspbian

$ git clone https://github.com/rt-net/RaspberryPiMouse.git
$ cd RaspberryPiMouse/utils
$ sudo apt install raspberrypi-kernel-headers build-essential
$ ./build_install.bash

for Ubuntu

$ git clone https://github.com/rt-net/RaspberryPiMouse.git
$ cd RaspberryPiMouse/utils
$ sudo apt install linux-headers-$(uname -r) build-essential
$ ./build_install.bash

Manual installation

$ git clone https://github.com/rt-net/RaspberryPiMouse.git
$ cd RaspberryPiMouse/src/drivers
$ make
$ sudo insmod rtmouse.ko

Notes for the installation (ドライバの導入の際の注意)

for Raspbian

Enable SPI and I2C functions via raspi-config command.

以下の設定を確認ください。 raspi-config コマンドで設定します。

  • SPI機能を「入」にする。
  • I2C機能を「入」にする。

2017年1月現在、以下の設定は不要です。
rtmouseをインストールして不具合が出た場合のみ以下の設定を追加で行ってください。

  • Device Tree機能を「切」にする。

for Raspberry Pi 4

Edit rtmouse.c to change the defined value RASPBERRYPI from '2' to '4'.

Raspberry Pi 4ではCPUのレジスタがそれまでのRaspberry Piとは異なります(issues#21)。
Raspberry Pi 4で本ドライバを使用する際にはrtmouse.cの以下の行(2020年4月13日現在の最新版のv2.1.0では54行目)をRASPBERRYPI 4に書き換えてビルドする必要があります。
./utils/build_install.bashを実行すると、Raspberry Piのモデルに合わせてrtmouse.c自動で書き換わります

// define the Raspberry Pi version here
// Raspberry Pi 1 B/A/B+/A+: 1
// Raspberry Pi 2 B        : 2
// Raspberry Pi 3 B/A+/B+  : 2
// Raspberry Pi 4 B        : 4
#define RASPBERRYPI 2

パルスカウンタについて

パルスカウンタは値の読み取りにI2Cを使用しています。仕様上は400kHzまでbaudrateを上げることができます(※1)。
I2Cのbaudrateを上げると通信に失敗する場合がある(issues#13)ので、基本的にはI2Cのbaudrateはデフォルト値(※2)から変更して62.5kHzに固定してください。

According to issues#13, it may be necessary to set the I2C baudrate lower than the default value. Add a following new line in /boot/firmware/config.txt to change the i2c_baudrate to 62.5 kHz.

/boot/firmware/config.txtに以下の1行を追加することでI2Cのbaudrateを62.5kHzに固定することができます。

dtparam=i2c_baudrate=62500

※1 Raspberry Pi 4 Model B(Ubuntu 18.04とUbuntu 20.04)を搭載して400kHzで通信できることを確認しています。
※2 現在設定されているI2Cのbaudrateは以下のコマンドを実行することで確認できます。

$ printf "%d\n" 0x$(xxd -ps /sys/class/i2c-adapter/i2c-1/of_node/clock-frequency)

Device files

For example code of device files, please refer to SampleProgram.

デバイスファイルの使用例はサンプルプログラムを参考にしてください。

Light sensor x4 (Input)

Read /dev/rtlightsensor0 to get proximity (0:far ~ 4095:close) of objects detected by light sensors.

/dev/rtlightsensor0を読み取り、光センサで検出された物体の近接度 (0:遠い ~ 4095:近い)を取得します。

# cat /dev/rtlightsensor0
# Return value: [front right] [right] [left] [front left]
$ cat /dev/rtlightsensor0
9 2 13 3

Switch x3 (Input)

Read /dev/rtswitch0 ~ /dev/rtswitch2 to get the switches on/off state.

/dev/rtswitch0 ~ /dev/rtswitch2 を読み取りスイッチのON/OFF状態を取得します。

# cat /dev/rtswitch[0,1]
# Return value: 1(Open), 0(Pressed)
$ cat /dev/rtswitch0

Buzzer (Output)

Write 0 ~ 20000 to /dev/rtbuzzer0 to beep the buzzer.

/dev/rtbuzzer0 に0 ~ 20000を書き込みブザーを鳴らします。

# echo 0 ~ 20000(Hz) > /dev/rtbuzzer0
$ echo 440 > /dev/rtbuzzer0
$ echo 0 > /dev/rtbuzzer0

LED x4 (Output)

Write 1/0 to /dev/rtled0 ~ /dev/rtled3 to turn on/off the LEDs.

/dev/rtled0 ~ /dev/rtled3 に1/0を書き込みLEDを点灯/消灯します。

# echo 0(OFF) or 1(ON) > /dev/rtled[0,1,2,3]
$ echo 1 > /dev/rtled0
$ echo 0 > /dev/rtled1

Motor enable (Output)

Write 1/0 to /dev/rtmotoren0 to enable/disable motors control.

/dev/rtmotoren0 に 1/0 を書き込みモータ操作を有効/無効にします。

# echo 0(disable) or 1(enable) > /dev/rtmotoren0
$ echo 1 > /dev/rtmotoren0

PWM frequency for left/right motor driver (Output)

Write 0 ~ ±10000 to /dev/rtmotor_raw_l0 or /dev/rtmotor_raw_r0 to set PWM frequency for motor drivers.

※ 0 ~ ±4 Hz will be reset to 0 Hz.

/dev/rtmotor_raw_l0 または /dev/rtmotor_raw_r0 に 0 ~ ±10000 を書き込み、モータドライバへのPWM周波数を設定します。

※ 0 ~ ±4 Hzは0Hzへリセットされます

# echo 0 ~ ±10000(Hz) > /dev/rtmotor_raw_[l0, r0]
$ echo 1 > /dev/rtmotoren0
$ echo 400 > /dev/rtmotor_raw_l0

PWM frequencies and drive duration (Output)

Write left and right PWM frequencies and drive duration to /dev/rtmotor0 to drive both motors.

/dev/rtmotor0に左右のPWM周波数と動作時間を書き込み、左右のモータを回します。

# echo [left_freq Hz] [right_freq Hz] [duration ms] > /dev/rtmotor0
$ echo 1 > /dev/rtmotoren0
$ echo 400 800 1000 > /dev/rtmotor0

Pulse counter x2 (Input/Output)

Read /dev/rtcounter_* to get pulse counts of PWM for motor drivers or write values to reset counts.

/dev/rtcounter_*を読み取りモータドライバへのPWMパルス数を取得します。また、値を書き込みカウントをリセットします。

  • unsigned counters : /dev/rtcounter_l0, /dev/rtcounter_r0
  • signed counters : /dev/rtcounter_l1, /dev/rtcounter_r1
# cat /dev/rtcounter_[l0, r0]
# Return value: 0 ~ 65565 (counts of PWM pulse)
# cat /dev/rtcounter_[l1, r1]
# Return value: -32767 ~ 32767 (counts of PWM pulse)
$ cat /dev/rtcounter_l0
1104
$ echo 0 > /dev/rtcounter_l0
$ cat /dev/rtcounter_l0
0

その他

その他のよくある質問についてはwikiにまとめています。

日経Linux連載

連載(Raspberry Piで始めるかんたんロボット製作)で上田氏が書いた シェルスクリプトは下記にあります。

https://github.com/ryuichiueda/RPiM

License

This repository except for SampleProgram directory is licensed under the GPL-2.0-only License, see LICENSE.

SampleProgram directory is licensed under the Apache 2.0 License, see SampleProgram / LICENSE.

このリポジトリはSampleProgramディレクトリを除きGPL-2.0-onlyライセンスで公開されています。詳細はLICENSEを確認してください。

SampleProgramディレクトリはApache-2.0ライセンスで公開されています。詳細はSampleProgram / LICENSEを確認してください。

Includings

This repository contains the code of the repository shown below.

このリポジトリは以下に示すリポジトリのコードを一部含みます。

raspberrypimouse's People

Contributors

aoki-rt avatar atsushisaito avatar rt-corp avatar ryuichiueda avatar shotaak avatar shu-13 avatar tabe avatar tiryoh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

raspberrypimouse's Issues

Step4.cでモータが回らない

不具合の概要

SampleProgramのstep4.cをコンパイルして実行したとき
17行目と25行目でモータが回転しなかった。
そのほかは正常に動作している。

実行環境

  • ハードウェア: ラズパイマウスV3、RaspberryPi 3 Model B
  • OS: Raspbian Buster (2020-02-13-raspbian-buster-full.img)
  • ソフトのバージョン: 2020/06/02のmasterブランチ (コミット af0c46a)

再現方法

  1. 初期設定を行い(SSH, I2C, SPIをEnableに)再起動
  2. ドライバインストールしたあと、SampleProgram階層に移動
  3. gcc step4.c
  4. ./a.out

期待する動作

step4.cを実行すると、90度回転を反時計回り、時計回り、時計回り、反時計回り
としてくれる。

ログ・画像

その他

step4.py
step4.sh
echo 400 > /dev/rtmotor_raw_l0
echo 400 > /dev/rtmotor_raw_r0

はそれぞれ正常に動作しています。

segmentation fault on i2c counter

version

$ uname -a
Linux raspberrypi 4.14.34-v7+ #1110 SMP Mon Apr 16 15:18:51 BST 2018 armv7l GNU/Linux
$ modinfo rtmouse.ko
filename:       /home/pi/RaspberryPiMouse/src/drivers/rtmouse.ko
description:    Raspberry Pi MicroMouse device driver
version:        1:1.2
license:        GPL
author:         RT Corporation
srcversion:     44399BB1055C8C6E6A376FA
alias:          spi:mcp3204
alias:          i2c:rtcntl
alias:          i2c:rtcntr
depends:
name:           rtmouse
vermagic:       4.14.34-v7+ SMP mod_unload modversions ARMv7 p2v8
$ i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: 10 11 -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

error log

$ cat /dev/rtcounter_r0
Segmentation fault

Message from syslogd@raspberrypi at Aug 26 21:07:36 ...
 kernel:[  164.608752] Internal error: Oops: 17 [#1] SMP ARM

Message from syslogd@raspberrypi at Aug 26 21:07:36 ...
 kernel:[  164.609069] Process cat (pid: 959, stack limit = 0xa9c28210)

Message from syslogd@raspberrypi at Aug 26 21:07:36 ...
 kernel:[  164.609080] Stack: (0xa9c29d50 to 0xa9c2a000)

Message from syslogd@raspberrypi at Aug 26 21:07:36 ...
 kernel:[  164.609094] 9d40:                                     00000026 8018bd84 a9c29d8c a9c29d68

Message from syslogd@raspberrypi at Aug 26 21:07:36 ...
 kernel:[  164.609112] 9d60: 8018bd84 8018b654 a9c29d8c a9c29d78 00000000 5359e768 00000026 00011d28

Message from syslogd@raspberrypi at Aug 26 21:07:36 ...
 kernel:[  164.609129] 9d80: a9c29dfc a9c29d90 8079e8d8 8018bd70 00011d28 00000000 00000000 014200ca

Message from syslogd@raspberrypi at Aug 26 21:07:36 ...
 kernel:[  164.609145] 9da0: a9c29da0 00000000 00000000 00000000 535b0490 00000026 5359e768 00000026

Message from syslogd@raspberrypi at Aug 26 21:07:36 ...
 kernel:[  164.609162] 9dc0: 8018bbe0 ba382600 00000000 00000000 00000000 a9c29de0 00000002 a9c29f80

Message from syslogd@raspberrypi at Aug 26 21:07:36 ...
 kernel:[  164.609179] 9de0: a9c29f80 b11ec600 a9c29e7c 00020000 a9c28000 00000000 a9c29e4c a9c29e08

Message from syslogd@raspberrypi at Aug 26 21:07:36 ...
 kernel:[  164.609196] 9e00: 805fcc84 805fc2a4 00000011 00000002 a9c29e1e 8079e94c 00000000 a9c29e28

Message from syslogd@raspberrypi at Aug 26 21:07:36 ...
 kernel:[  164.609213] 9e20: 5359e768 00000026 a9c29f80 a9c29f80 b11ec600 a9c29e7c 00020000 a9c28000

Message from syslogd@raspberrypi at Aug 26 21:07:36 ...
 kernel:[  164.609230] 9e40: a9c29e6c a9c29e50 7f4a7a84 805fcc4c a9c29f80 a9c29f80 76bb3000 a9c29f80

Message from syslogd@raspberrypi at Aug 26 21:07:36 ...
 kernel:[  164.609246] 9e60: a9c29edc a9c29e70 7f4a851c 7f4a7a5c ba980454 00000000 a9c29ea4 a9c29fb0

Message from syslogd@raspberrypi at Aug 26 21:07:36 ...
 kernel:[  164.609263] 9e80: b13b0f00 00000817 76bb2000 b906d340 b906d378 807a05fc a9c29efc a9c29ea8

Message from syslogd@raspberrypi at Aug 26 21:07:36 ...
 kernel:[  164.609280] 9ea0: 807a05fc 8016cce8 00000000 00100073 00000000 76bb2000 a9c29ee4 00022000

Message from syslogd@raspberrypi at Aug 26 21:07:36 ...
 kernel:[  164.609296] 9ec0: b10a7e40 a9c29f80 76bb3000 a9c29f80 a9c29f4c a9c29ee0 8028a624 7f4a84d4

Message from syslogd@raspberrypi at Aug 26 21:07:36 ...
 kernel:[  164.609313] 9ee0: 76bb2000 a9c29fb0 00001000 000001ff a9c29fac a9c29f00 801011e4 807a0468

Message from syslogd@raspberrypi at Aug 26 21:07:36 ...
 kernel:[  164.609330] 9f00: a9c29f48 00000003 00022000 00000000 00000000 80242100 a9c29f74 8028a790

Message from syslogd@raspberrypi at Aug 26 21:07:36 ...
 kernel:[  164.609346] 9f20: 80242100 8016cd34 00020000 b10a7e40 76bb3000 a9c29f80 80108204 a9c28000

Message from syslogd@raspberrypi at Aug 26 21:07:36 ...
 kernel:[  164.609363] 9f40: a9c29f7c a9c29f50 8028a7b8 8028a5f8 00000022 802aadf8 a9c29f7c b10a7e40

Message from syslogd@raspberrypi at Aug 26 21:07:36 ...
 kernel:[  164.609380] 9f60: b10a7e40 00020000 76bb3000 80108204 a9c29fa4 a9c29f80 8028ad68 8028a728

Message from syslogd@raspberrypi at Aug 26 21:07:36 ...
 kernel:[  164.609396] 9f80: 00000000 00000000 00020000 7fffe000 00020000 00000003 00000000 a9c29fa8

Message from syslogd@raspberrypi at Aug 26 21:07:36 ...
 kernel:[  164.609413] 9fa0: 80108060 8028ad20 00020000 7fffe000 00000003 76bb3000 00020000 00027184

Message from syslogd@raspberrypi at Aug 26 21:07:36 ...
 kernel:[  164.609429] 9fc0: 00020000 7fffe000 00020000 00000003 00000003 00020000 ffffffff 00000000

Message from syslogd@raspberrypi at Aug 26 21:07:36 ...
 kernel:[  164.609446] 9fe0: 00000000 7e98d034 000141cc 76e300cc 60000010 00000003 00000000 00000000

Message from syslogd@raspberrypi at Aug 26 21:07:36 ...
 kernel:[  164.609693] Code: e1a06003 e5db9004 e1a00000 e1a00000 (e5942008)

Makefile problem

make -C /usr/src/linux-headers-uname -r M=pwd V=1 modules results in:
***No rule to make target `modules. Stop

Error ‘struct spi_transfer’ has no member named ‘delay_usecs’ on Kernel > 5.12

不具合の概要

5.12より新しいバージョンのカーネルではspi_transferに"delay_usecs" fieldがないため、rtmouse.cをそのままビルドしようとするとエラーが出ます

実行環境

再現方法

  1. ./utils/build_install.bash を実行する
  2. 不具合が発生する

期待する動作

エラーが出ずにinsmodまで完了する

ログ・画像

$ ./utils/build_install.bash 
build_install_header_from_apt_raspi2.bash
make -C /usr/src/linux-headers-5.15.32-v7+ M=/home/pi/RaspberryPiMouse/src/drivers V=0 clean
make[1]: Entering directory '/usr/src/linux-headers-5.15.32-v7+'
make[1]: Leaving directory '/usr/src/linux-headers-5.15.32-v7+'
make -C /usr/src/linux-headers-5.15.32-v7+ M=/home/pi/RaspberryPiMouse/src/drivers V=0 modules
make[1]: Entering directory '/usr/src/linux-headers-5.15.32-v7+'
  CC [M]  /home/pi/RaspberryPiMouse/src/drivers/rtmouse.o
/home/pi/RaspberryPiMouse/src/drivers/rtmouse.c: In function ‘mcp3204_probe’:
/home/pi/RaspberryPiMouse/src/drivers/rtmouse.c:1720:12: error: ‘struct spi_transfer’ has no member named ‘delay_usecs’
 1720 |  data->xfer.delay_usecs = 0;
      |            ^
make[2]: *** [scripts/Makefile.build:277: /home/pi/RaspberryPiMouse/src/drivers/rtmouse.o] Error 1
make[1]: *** [Makefile:1868: /home/pi/RaspberryPiMouse/src/drivers] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.15.32-v7+'
make: *** [Makefile:9: rtmouse.ko] Error 2

$ uname -a
Linux raspberrypi 5.15.32-v7+ #1538 SMP Thu Mar 31 19:38:48 BST 2022 armv7l GNU/Linux
pi@raspberrypi:~/RaspberryPiMouse $ lsb
lsblk        lsb_release  

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Raspbian
Description:	Raspbian GNU/Linux 11 (bullseye)
Release:	11
Codename:	bullseye

その他

このコミットで取り除かれている
raspberrypi/linux@3ab1cce

delay.valueを使うようになっている
raspberrypi/linux@05d8a01

delay.valueはこのコミットで追加された(Kernel 5.10以降で利用可能)
raspberrypi/linux@bebcfd2

delay_usecは0で初期化してるので取り除いても問題ない可能性がある

data->xfer.delay_usecs = 0;

コントリビュータの皆様へ:GPLv3からGPLv2への変更について

本リポジトリはライセンスをGPLv3として公開していますが、GPLv2で公開されているコード及びライブラリを使用しているため、ライセンス違反とならないようにGPLv2へ変更します。

そこで、GPLv3が適用される前提でコントリビュートして頂いた皆様にお願いです。

  • ライセンス変更に異論がなければ:+1:でリアクションをお願いします。
  • ライセンス変更に意見がある場合はコメントをお願いします。

皆様の合意を得た上でライセンスを変更します。


Organization外コントリビュータ一覧(直近のPRを抜粋しています):

@AtsushiSaito
#12

@ryuichiueda
#2

@tabe
#5


Organization内

@aoki-rt
@ShotaAk
@shu-rt
@Tiryoh


  • ソースコードの利用:
  • ライブラリの使用:
    • #include <linux/cdev.h>
      #include <linux/delay.h>
      #include <linux/device.h>
      #include <linux/errno.h>
      #include <linux/fs.h>
      #include <linux/i2c.h>
      #include <linux/iio/iio.h>
      #include <linux/init.h>
      #include <linux/io.h>
      #include <linux/ioport.h>
      #include <linux/kdev_t.h>
      #include <linux/kernel.h>
      #include <linux/module.h>
      #include <linux/moduleparam.h>
      #include <linux/mutex.h>
      #include <linux/sched.h>
      #include <linux/slab.h>
      #include <linux/spi/spi.h>
      #include <linux/stat.h>
      #include <linux/timer.h>
      #include <linux/types.h>
      #include <linux/uaccess.h>
      #include <linux/version.h>

cannot use rtcounter in high I2C SCL frequency

特定の条件下ではrtcounterが使用できない場合があります。詳しくは以下の「考えられる原因と対処方法」に書いていますが、CPUのgovernorをpowersaveに指定し、CPUクロックを下げることでエラーを回避してrtcounterを使用することができるようになります。

環境

Raspberry Pi 3 Model B

OS

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.1 LTS
Release:        18.04
Codename:       bionic
$ uname -a
Linux ubuntu 4.15.0-1027-raspi2 #29-Ubuntu SMP PREEMPT Wed Oct 24 08:56:30 UTC 2018 aarch64 aarch64 aarch64 GNU/Linux

rt-net/RaspberryPiMouse のバージョン

$ git log -n 1
commit 864acceef45eac90b0c7f8342e0371468ea67e62

現象

i2c-toolsでデバイスに直接アクセスしようとしてもRead faildとなる

$ sudo i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: 10 11 -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
$ sudo i2cget -y 1 0x10 0x10 w
Error: Read failed

デバイスドライバをインストールする際にrtcounternot found, or wrongとなる

$ cd RaspberryPiMouse/src/drivers/
$ make
$ sudo insmod rtmouse.ko
$ dmesg
[   70.775579] rtmouse: loading driver...
[   70.776570] rtmouse: rtcounter not found, or wrong i2c device probed
[   70.777546] rtmouse: rtcounter not found, or wrong i2c device probed
[   70.886544] rtmouse: mcp3204 probed
[   70.886606] rtmouse: 15 devices loaded.
[   70.886610] rtmouse: module installed at 4294910017

I2Cの波形

エラーが出る場合のI2Cの波形

tek00027

エラーが出ない場合のI2Cの波形

  • モータのスイッチのオン/オフ切り替えを繰り返すとエラーが出ず、rtcounterにアクセスできる場合があります。
    tek00028

考えられる原因と対処方法

今回使用した環境では、デフォルトでI2Cのbaudrateは100kHzですが、CPUのクロックが600MHzまで下がるとI2Cのbaudrateが62.5kHzまで下がるようです。
I2Cのbaudrateを62.5kHzまで下げるとrtcounterへのアクセスに失敗しません。以下の方法でCPUのクロックを下げ、I2Cのbaudrateを62.5kHzにすることができます。

$ sudo apt install cpufrequtils
$ sudo cpufreq-set -g powersave

参考

rtcounterが見当たらない

不具合の概要

build_install.bashをした際に、rtcounterが入らない。

実行環境

  • ハードウェア: ラズパイマウスV3、Raspberry Pi 3 Model B
  • OS: Raspbian Buster (2020-02-13-raspbian-buster-full.img)
  • ソフトのバージョン: 2020/06/02のmasterブランチ (コミット af0c46a)

再現方法

  1. 2020-02-13-raspbian-buster-full.imgが入ったmicroSDカードを使ってラズパイマウスを起動
  2. 設定でSSH, I2C, SPIなどをENABLEにして再起動。
  3. RaspberryPiMouseをgit cloneする。
  4. raspberrypi-kernel-headersをinstallする。
  5. build_install.bashを実行する。

期待する動作

/dev/にrtcounterが存在して欲しい

ログ・画像

dmesgを実行すると、以下のメッセージが表示される。

[   65.005554] rtmouse: rtcounter not found, or wrong i2c device probed
[   65.006389] rtmouse: rtcounter not found, or wrong i2c device probed

その他

sudo apt install i2c-tools
i2cdetect -y 1

を実行したところ

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: 10 11 -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --

という結果をえた。

i2cget -y 1 0x10 0x10 w | sed 's/x\(..\)\(..\)/x\2\1/g'

を実行すると

0x1010

という結果を得た。

sudo i2cset -y 1 0x10 0x10 0x00 0x00 I

を実行すると

0x0000

という結果を得た。

また、uname -aの実行結果は以下の通りである。

Linux raspberrypi 4.19.97-v7+ #1294 SMP Thu Jan 30 13:15:58 GMT 2020 armv7l GNU/Linux

サンプルプログラムのドキュメント追加

Is your feature request related to a problem? Please describe.
SampleProgramディレクトリのファイルに、使い方のドキュメントがない。

Describe the solution you'd like
READMEファイルを追加する。

Describe alternatives you've considered
各ファイルの冒頭に使い方を記載する。

Raspberry Pi OSカーネル6.1.21-v8+でビルドに失敗する

不具合の概要

23年5月にリリースされたRaspberry Pi OSでデバイスドライバのソースビルドに失敗します。

実行環境

  • OS: Raspberry Pi OS bullseye
  • ソフトのバージョン: 53066c2
  • Raspberry Pi 4を使用
$ lsb_release -a
No LSB modules are available.
Distributor ID:	Raspbian
Description:	Raspbian GNU/Linux 11 (bullseye)
Release:	11
Codename:	bullseye
$ uname -a
Linux raspberrypi 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr  3 17:24:16 BST 2023 aarch64 GNU/Linux

再現方法

  1. 'utils/build_install.bash ' を実行する
  2. 下記のエラーが表示される
$ ./build_install.bash 
build_install_header_from_apt_raspi4.bash
===================
ERROR: No kernel header files found.
If you need someone's support, you should share this information.
Linux raspberrypi 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr  3 17:24:16 BST 2023 aarch64 GNU/Linux
No LSB modules are available.
Distributor ID:	Raspbian
Description:	Raspbian GNU/Linux 11 (bullseye)
Release:	11
Codename:	bullseye
/usr/src/linux-headers-6.1.21+:
Documentation  Makefile        arch   certs   drivers  include	io_uring  kernel  mm   rust	scripts   sound  usr
Kconfig        Module.symvers  block  crypto  fs       init	ipc	  lib	  net  samples	security  tools  virt

/usr/src/linux-headers-6.1.21-v7+:
Documentation  Makefile        arch   certs   drivers  include	io_uring  kernel  mm   rust	scripts   sound  usr
Kconfig        Module.symvers  block  crypto  fs       init	ipc	  lib	  net  samples	security  tools  virt

/usr/src/linux-headers-6.1.21-v7l+:
Documentation  Makefile        arch   certs   drivers  include	io_uring  kernel  mm   rust	scripts   sound  usr
Kconfig        Module.symvers  block  crypto  fs       init	ipc	  lib	  net  samples	security  tools  virt
===================

期待する動作

ビルドに成功する

その他

どうやら、Raspberry Pi 4だと、32bit版のOSをインストールしても、64bit版のカーネルが起動するようです。

/boot/config.txtarm_64bit=0を追記して再起動しました。
デバイスドライバのビルドが始まりましたが、別のエラーが表示されます。

こちらは、#78 取り入れ済みです。

# 32bit版のカーネルが適用されていることの確認
$ uname -a
Linux raspberrypi 6.1.21-v7l+ #1642 SMP Mon Apr  3 17:22:30 BST 2023 armv7l GNU/Linux
# デバイスドライバのビルド
$ ./build_install.bash 
build_install_header_from_apt_raspi4.bash
make -C /usr/src/linux-headers-6.1.21-v7l+ M=/home/pi/RaspberryPiMouse/src/drivers V=0 clean
make[1]: ディレクトリ '/usr/src/linux-headers-6.1.21-v7l+' に入ります
make[1]: ディレクトリ '/usr/src/linux-headers-6.1.21-v7l+' から出ます
make -C /usr/src/linux-headers-6.1.21-v7l+ M=/home/pi/RaspberryPiMouse/src/drivers V=0 modules
make[1]: ディレクトリ '/usr/src/linux-headers-6.1.21-v7l+' に入ります
  CC [M]  /home/pi/RaspberryPiMouse/src/drivers/rtmouse.o
/home/pi/RaspberryPiMouse/src/drivers/rtmouse.c:323:15: error: initialization of ‘void (*)(struct spi_device *)’ from incompatible pointer type ‘int (*)(struct spi_device *)’ [-Werror=incompatible-pointer-types]
  323 |     .remove = mcp3204_remove,
      |               ^~~~~~~~~~~~~~
/home/pi/RaspberryPiMouse/src/drivers/rtmouse.c:323:15: note: (near initialization for ‘mcp3204_driver.remove’)
/home/pi/RaspberryPiMouse/src/drivers/rtmouse.c:361:15: error: initialization of ‘void (*)(struct i2c_client *)’ from incompatible pointer type ‘int (*)(struct i2c_client *)’ [-Werror=incompatible-pointer-types]
  361 |     .remove = rtcnt_i2c_remove,
      |               ^~~~~~~~~~~~~~~~
/home/pi/RaspberryPiMouse/src/drivers/rtmouse.c:361:15: note: (near initialization for ‘i2c_counter_driver.remove’)
/home/pi/RaspberryPiMouse/src/drivers/rtmouse.c: In function ‘mcp3204_get_value’:
/home/pi/RaspberryPiMouse/src/drivers/rtmouse.c:1747:11: error: implicit declaration of function ‘spi_busnum_to_master’ [-Werror=implicit-function-declaration]
 1747 |  master = spi_busnum_to_master(mcp3204_info.bus_num);
      |           ^~~~~~~~~~~~~~~~~~~~
/home/pi/RaspberryPiMouse/src/drivers/rtmouse.c:1747:9: warning: assignment to ‘struct spi_controller *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
 1747 |  master = spi_busnum_to_master(mcp3204_info.bus_num);
      |         ^
/home/pi/RaspberryPiMouse/src/drivers/rtmouse.c: In function ‘mcp3204_init’:
/home/pi/RaspberryPiMouse/src/drivers/rtmouse.c:1809:9: warning: assignment to ‘struct spi_controller *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
 1809 |  master = spi_busnum_to_master(mcp3204_info.bus_num);
      |         ^
/home/pi/RaspberryPiMouse/src/drivers/rtmouse.c: In function ‘mcp3204_exit’:
/home/pi/RaspberryPiMouse/src/drivers/rtmouse.c:1838:9: warning: assignment to ‘struct spi_controller *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
 1838 |  master = spi_busnum_to_master(mcp3204_info.bus_num);
      |         ^
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:250: /home/pi/RaspberryPiMouse/src/drivers/rtmouse.o] エラー 1
make[1]: *** [Makefile:2012: /home/pi/RaspberryPiMouse/src/drivers] エラー 2
make[1]: ディレクトリ '/usr/src/linux-headers-6.1.21-v7l+' から出ます
make: *** [Makefile:9: rtmouse.ko] エラー 2

can`t access rtbuzzer0 , rtmotor_raw_l0,r0 , rtcounter_l1,l0

os : ubuntu 20.04 lts
raspberry pi 4 model b
already set up dtparam=i2c_baudrate=62500

i can access the leds , lightsensors and the switch but can access the motor, buzzer or the counter

if i try to use cat /dev/rtcounter_l0 i will get
no such file or directory
if i try to echo /dev/rtmotor_raw_l0
i get permission denied
i don't know from where is this issue i followed the install instructions as described in this page please tell me if i missed anything

step3.py : inconsistent use of tabs and spaces in indentation

Describe the bug

step3.py を実行するとインデントずれのエラーがでる

Additional context

$ uname -a
Linux ubuntu 4.15.0-1054-raspi2 #58-Ubuntu SMP PREEMPT Wed Jan 15 19:25:11 UTC 2020 aarch64 aarch64 aarch64 GNU/Linux

$ cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.3 LTS"

Full log

$ python3 step3.py

  File "step3.py", line 13
    break
        ^
TabError: inconsistent use of tabs and spaces in indentation

size_t型の変数のフォーマットに関してビルド時に警告が出る

Describe the bug

rtmouse.cをビルドするとフォーマットに関して以下の警告が出ている

format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘size_t {aka long unsigned int}’

size_t型の変数のフォーマットは%zdに統一することが望ましい

Full log

$ make
make -C /usr/src/linux-headers-`uname -r` M=`pwd` V=0 modules
make[1]: Entering directory '/usr/src/linux-headers-4.15.0-1052-raspi2'
  CC [M]  /home/ubuntu/RaspberryPiMouse/src/drivers/rtmouse.o
In file included from ./include/linux/printk.h:7:0,
                 from ./include/linux/kernel.h:14,
                 from ./include/linux/list.h:9,
                 from ./include/linux/kobject.h:20,
                 from ./include/linux/cdev.h:5,
                 from /home/ubuntu/RaspberryPiMouse/src/drivers/rtmouse.c:25:
/home/ubuntu/RaspberryPiMouse/src/drivers/rtmouse.c: In function ‘sw_read’:
./include/linux/kern_levels.h:5:18: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘size_t {aka long unsigned int}’ [-Wformat=]
 #define KERN_SOH "\001"  /* ASCII Start Of Header */
                  ^
./include/linux/kern_levels.h:14:19: note: in expansion of macro ‘KERN_SOH’
 #define KERN_INFO KERN_SOH "6" /* informational */
                   ^~~~~~~~
/home/ubuntu/RaspberryPiMouse/src/drivers/rtmouse.c:586:10: note: in expansion of macro ‘KERN_INFO’
   printk(KERN_INFO "err sample_char_read size(%d)\n", count);
          ^~~~~~~~~
/home/ubuntu/RaspberryPiMouse/src/drivers/rtmouse.c:586:48: note: format string is defined here
   printk(KERN_INFO "err sample_char_read size(%d)\n", count);
                                               ~^
                                               %ld
In file included from ./include/linux/printk.h:7:0,
                 from ./include/linux/kernel.h:14,
                 from ./include/linux/list.h:9,
                 from ./include/linux/kobject.h:20,
                 from ./include/linux/cdev.h:5,
                 from /home/ubuntu/RaspberryPiMouse/src/drivers/rtmouse.c:25:
/home/ubuntu/RaspberryPiMouse/src/drivers/rtmouse.c: In function ‘sensor_read’:
./include/linux/kern_levels.h:5:18: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘size_t {aka long unsigned int}’ [-Wformat=]
 #define KERN_SOH "\001"  /* ASCII Start Of Header */
                  ^
./include/linux/kern_levels.h:14:19: note: in expansion of macro ‘KERN_SOH’
 #define KERN_INFO KERN_SOH "6" /* informational */
                   ^~~~~~~~
/home/ubuntu/RaspberryPiMouse/src/drivers/rtmouse.c:657:10: note: in expansion of macro ‘KERN_INFO’
   printk(KERN_INFO "err sample_char_read size(%d)\n", count);
          ^~~~~~~~~
/home/ubuntu/RaspberryPiMouse/src/drivers/rtmouse.c:657:48: note: format string is defined here
   printk(KERN_INFO "err sample_char_read size(%d)\n", count);
                                               ~^
                                               %ld
In file included from ./include/linux/printk.h:7:0,
                 from ./include/linux/kernel.h:14,
                 from ./include/linux/list.h:9,
                 from ./include/linux/kobject.h:20,
                 from ./include/linux/cdev.h:5,
                 from /home/ubuntu/RaspberryPiMouse/src/drivers/rtmouse.c:25:
/home/ubuntu/RaspberryPiMouse/src/drivers/rtmouse.c: In function ‘rtcnt_read’:
./include/linux/kern_levels.h:5:18: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘size_t {aka long unsigned int}’ [-Wformat=]
 #define KERN_SOH "\001"  /* ASCII Start Of Header */
                  ^
./include/linux/kern_levels.h:14:19: note: in expansion of macro ‘KERN_SOH’
 #define KERN_INFO KERN_SOH "6" /* informational */
                   ^~~~~~~~
/home/ubuntu/RaspberryPiMouse/src/drivers/rtmouse.c:1188:10: note: in expansion of macro ‘KERN_INFO’
   printk(KERN_INFO "err sample_char_read size(%d)\n", count);
          ^~~~~~~~~
/home/ubuntu/RaspberryPiMouse/src/drivers/rtmouse.c:1188:48: note: format string is defined here
   printk(KERN_INFO "err sample_char_read size(%d)\n", count);
                                               ~^
                                               %ld
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /home/ubuntu/RaspberryPiMouse/src/drivers/rtmouse.mod.o
  LD [M]  /home/ubuntu/RaspberryPiMouse/src/drivers/rtmouse.ko
make[1]: Leaving directory '/usr/src/linux-headers-4.15.0-1052-raspi2'

セマンティックバージョニングに移行する

現状では、1:1.4などのようにタグのようなバージョニングをしているが、多くのカーネルモジュールでは1.1.4などのようにセマンティックバージョニングが採用されている。

そこで、次からバージョニングをセマンティックバージョニングにすることを提案する。
https://semver.org/

コントリビュータの皆様へ:サンプルプログラムのライセンスをApache-2.0に変更することについて

本リポジトリのライセンスはGPLv2が適用されています。
しかし、サンプルプログラムにGPLv2が適用されると、サンプルのコードを流用しづらいという問題があります。

そこで、サンプルプログラムのディレクトリSampleProgramsには、Apache-2.0ライセンスを適用することを提案します。

SampleProgramsディレクトリにコントリビュートして頂いた皆様にお願いです。

  • ライセンス変更に異論がなければ:+1:でリアクションをお願いします。
  • ライセンス変更に意見がある場合はコメントをお願いします。

皆様の合意を得た上でライセンスを変更します。


コントリビュータ一覧(すべて、Organization内です)

@aoki-rt
@ShotaAk
@shu-rt
@Tiryoh

makeコマンドが見つらないのでbuild-essentialのインストールをREADMEに追加して欲しい

現状の問題点

Ubuntu 18.04をインストールした後、./utils/build_install.bashを実行しましたが下記のエラーが出ます。

ubuntu@ubuntu:~/RaspberryPiMouse/utils$ ./build_install.bash 
#!/bin/bash -vxe

dir=$(dirname $0)/../
++ dirname /home/ubuntu/RaspberryPiMouse/utils/build_install.ubuntu14.bash
+ dir=/home/ubuntu/RaspberryPiMouse/utils/../
[ ! -e /usr/src/linux-headers-$(uname -r) ] && { bash -e $dir/utils/print_env.bash "No kernel header files found."; exit 1; }
++ uname -r
+ '[' '!' -e /usr/src/linux-headers-5.3.0-1026-raspi2 ']'
cd $dir/src/drivers/
+ cd /home/ubuntu/RaspberryPiMouse/utils/..//src/drivers/
rm Makefile
+ rm Makefile
ln -s Makefile.ubuntu14 Makefile
+ ln -s Makefile.ubuntu14 Makefile
make clean
+ make clean
/home/ubuntu/RaspberryPiMouse/utils/build_install.ubuntu14.bash: line 8: make: command not found

改善案

makeがインストールされていないので、sudo apt install build-essentialをREADMEのインストール手順に追加して欲しい。

build_install.ubuntu14.bash error

make clean
make -C /usr/linux-headers-uname -r M=pwd V=1 clean
make[1]: Entering directory '/usr/src/linux-headers-4.4.38-v7+'
make[1]: ***No rule to make target 'clean'. Stop.
make[1]: Leaving directory '/usr/src/linux-headers-4.4.38-v7+'
Makefile:10: recipe for target 'clean' failed
make: *** [clean] Error 2

rmmod後、lightsensorが動かない

Describe the bug

sudo rmmod rtmouse実行後、utils/build_install.bashを実行したが、lightsensorが動かない。

Expected behavior

dmsegでログを見ると、rtmouse: mcp3204 removedの後、rtmouse: mcp3204 probedのメッセージが出てないので、SPIモジュールの生成に失敗しているように見える。

Full log

dmesg | grep rtmouse
[  125.082949] rtmouse: loading out-of-tree module taints kernel.
[  125.084309] rtmouse: module verification failed: signature and/or required key missing - tainting kernel
[  125.085153] rtmouse: loading driver...
[  125.086939] rtmouse: new i2c device probed, id.name=rtcounter_l, id.driver_data=0, addr=0x10
[  125.089001] rtmouse: new i2c device probed, id.name=rtcounter_r, id.driver_data=1, addr=0x11
[  125.199774] rtmouse: mcp3204 probed
[  125.199841] rtmouse: 15 devices loaded.
[  125.199848] rtmouse: module installed at 4294923596
[  506.687403] rtmouse: mcp3204 removed
[  506.687691] rtmouse: i2c device 0x11 removed
[  506.687872] rtmouse: i2c device 0x10 removed
[  506.688062] rtmouse: module removed at 4295018974
[  528.872773] rtmouse: loading driver...
[  528.874750] rtmouse: new i2c device probed, id.name=rtcounter_l, id.driver_data=0, addr=0x10
[  528.876800] rtmouse: new i2c device probed, id.name=rtcounter_r, id.driver_data=1, addr=0x11
[  528.991587] rtmouse: 15 devices loaded.
[  528.991595] rtmouse: module installed at 4295024550
[  587.657944] rtmouse: i2c device 0x11 removed
[  587.658096] rtmouse: i2c device 0x10 removed
[  587.658268] rtmouse: module removed at 4295039216
[  606.010924] rtmouse: loading driver...
[  606.012570] rtmouse: new i2c device probed, id.name=rtcounter_l, id.driver_data=0, addr=0x10
[  606.015360] rtmouse: new i2c device probed, id.name=rtcounter_r, id.driver_data=1, addr=0x11
[  606.125167] rtmouse: 15 devices loaded.
[  606.125177] rtmouse: module installed at 4295043833
[ 1327.974936] rtmouse: i2c device 0x11 removed
[ 1327.975134] rtmouse: i2c device 0x10 removed
[ 1327.975323] rtmouse: module removed at 4295224292
[ 1347.361006] rtmouse: loading driver...
[ 1347.362846] rtmouse: new i2c device probed, id.name=rtcounter_l, id.driver_data=0, addr=0x10
[ 1347.365003] rtmouse: new i2c device probed, id.name=rtcounter_r, id.driver_data=1, addr=0x11
[ 1347.490002] rtmouse: 15 devices loaded.
[ 1347.490011] rtmouse: module installed at 4295229171

デバドラで5.10.11-v7+の対応予定はありますか?

現状の問題点

現在取扱説明書_2020_03_01.PDFに従い、「5.デバイスドライバーのインストールについて」を実施しようとしています。
uname -r でバージョンを確認すると 5.10.11-7+ と返ってきます。
しかしgithub上のlib/Pi2B+以下に該当フォルダのrtmouse.koは存在しないのでinsmodができない状態です。

改善案

5.10.11-v7+用のrtmouse.koの提供をお願いしたいです。

代替案

ソースから自分でビルドできるのであれば手順を教示いただけると助かります。

その他

よろしくお願いいたします。

Add Raspberry Pi 4 support

TODO

  • Raspberry Pi 4対応のドライバを用意
    • #22 にて対応予定
  • Raspberry Pi 4Bを搭載したRaspberry Pi Mouse V3にて動作確認
  • Raspberry Pi 3B/3B+を搭載したRaspberry Pi Mouse V3にて動作確認
  • ビルド方法についてドキュメント作成

資料

parseFreqで整数形式に変換できなければエラーを返すようにする

現状の問題点

ラズパイマウスのデバドラでは独自関数を使用してデバイスファイルに書き込んだ文字列をintに変換しています。

static int parseFreq(const char __user *buf, size_t count, int *ret)

この関数では"12.5"や"12-5"のような数字以外の文字列を含む入力の場合、どちらも"125"と変換されます。
現状のROSパッケージやサンプルプログラムではint以外を入力しない使い方をしているので問題は出ていないようですが、"12.5"を入力した際に"12"ではなく"125"と変換されるのは望ましい実装ではないと思います。

改善案

そこでこのparseFreq関数ではint以外を受け付けないことにしている(intだけを引数として取る前提)ため、Linux kernelのkstrtox.c内の関数と同様に、intに変換できない値が指定された場合にはInvalid argument(-22)を返すように変更しようと思います。
https://github.com/torvalds/linux/blob/master/lib/kstrtox.c

現状ではintに変換できないような値が書き込まれた場合、エラーを返さず、正常にデバイスファイルへ書き込みできたことを示す値(デバイスファイルへの入力文字数)を返しています。これをInvalid argumentを返すように変更すると、ファイルへの書き込みが正常終了せず後方互換性が失われます。

その他

この変更について、社内で確認したところ既存のマニュアルや本デバイスドライバを利用したプログラムで不都合がおきることはなさそうでした。

サンプルプログラムの追加

Is your feature request related to a problem? Please describe.
サンプルプログラムがstep1(LED点灯)、step2(ブザー)、step3(スイッチ入力)しかない。
モータ、センサ、カウンタのサンプルプログラムもほしい。

Describe the solution you'd like
サンプルプログラムを作成する。

compile error on Linux kernel 4.15.0

a compile error occurred on Linux kernel 4.15.0 (Ubuntu Bionic)

ubuntu@ubuntu:~$ ~/RaspberryPiMouse/utils/build_install.ubuntu14.bash
#!/bin/bash -vxe

dir=$(dirname $0)/../
++ dirname /home/ubuntu/RaspberryPiMouse/utils/build_install.ubuntu14.bash
+ dir=/home/ubuntu/RaspberryPiMouse/utils/../

cd $dir/src/drivers/
+ cd /home/ubuntu/RaspberryPiMouse/utils/..//src/drivers/
rm Makefile
+ rm Makefile
ln -s Makefile.ubuntu14 Makefile
+ ln -s Makefile.ubuntu14 Makefile
make clean
+ make clean
make -C /usr/src/linux-headers-`uname -r` M=`pwd` V=1 clean
make[1]: Entering directory '/usr/src/linux-headers-4.15.0-1010-raspi2'
make -f ./scripts/Makefile.clean obj=/home/ubuntu/RaspberryPiMouse/src/drivers
  rm -rf /home/ubuntu/RaspberryPiMouse/src/drivers/.tmp_versions
  rm -f /home/ubuntu/RaspberryPiMouse/src/drivers/Module.symvers
make[1]: Leaving directory '/usr/src/linux-headers-4.15.0-1010-raspi2'
make
+ make
make -C /usr/src/linux-headers-`uname -r` M=`pwd` V=1 modules
make[1]: Entering directory '/usr/src/linux-headers-4.15.0-1010-raspi2'
test -e include/generated/autoconf.h -a -e include/config/auto.conf || (		\
echo >&2;							\
echo >&2 "  ERROR: Kernel configuration is invalid.";		\
echo >&2 "         include/generated/autoconf.h or include/config/auto.conf are missing.";\
echo >&2 "         Run 'make oldconfig && make prepare' on kernel src to fix it.";	\
echo >&2 ;							\
/bin/false)
mkdir -p /home/ubuntu/RaspberryPiMouse/src/drivers/.tmp_versions ; rm -f /home/ubuntu/RaspberryPiMouse/src/drivers/.tmp_versions/*
make -f ./scripts/Makefile.build obj=/home/ubuntu/RaspberryPiMouse/src/drivers
  gcc -Wp,-MD,/home/ubuntu/RaspberryPiMouse/src/drivers/.rtmouse.o.d  -nostdinc -isystem /usr/lib/gcc/arm-linux-gnueabihf/7/include  -I./arch/arm/include -I./arch/arm/include/generated  -I./include -I./arch/arm/include/uapi -I./arch/arm/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/kconfig.h -Iubuntu/include  -D__KERNEL__ -mlittle-endian -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -Werror-implicit-function-declaration -Wno-format-security -std=gnu89 -fno-PIE -fno-dwarf2-cfi-asm -fno-omit-frame-pointer -mapcs -mno-sched-prolog -fno-ipa-sra -mabi=aapcs-linux -mno-thumb-interwork -mfpu=vfp -funwind-tables -marm -D__LINUX_ARM_ARCH__=7 -march=armv7-a -msoft-float -Uarm -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -Wno-int-in-bool-context -O2 --param=allow-store-data-races=0 -DCC_HAVE_ASM_GOTO -Wframe-larger-than=1024 -fstack-protector-strong -Wno-unused-but-set-variable -Wno-unused-const-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-var-tracking-assignments -pg -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fno-merge-all-constants -fmerge-constants -fno-stack-check -fconserve-stack -Werror=implicit-int -Werror=strict-prototypes -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init  -DMODULE  -DKBUILD_BASENAME='"rtmouse"'  -DKBUILD_MODNAME='"rtmouse"' -c -o /home/ubuntu/RaspberryPiMouse/src/drivers/.tmp_rtmouse.o /home/ubuntu/RaspberryPiMouse/src/drivers/rtmouse.c
/home/ubuntu/RaspberryPiMouse/src/drivers/rtmouse.c: In function ‘sw_read’:
/home/ubuntu/RaspberryPiMouse/src/drivers/rtmouse.c:566:6: error: implicit declaration of function ‘copy_to_user’; did you mean ‘raw_copy_to_user’? [-Werror=implicit-function-declaration]
  if (copy_to_user((void *)buf, &rw_buf, count)) {
      ^~~~~~~~~~~~
      raw_copy_to_user
/home/ubuntu/RaspberryPiMouse/src/drivers/rtmouse.c: In function ‘parseFreq’:
/home/ubuntu/RaspberryPiMouse/src/drivers/rtmouse.c:816:7: error: implicit declaration of function ‘copy_from_user’; did you mean ‘raw_copy_from_user’? [-Werror=implicit-function-declaration]
   if (copy_from_user(&cval, buf + i, sizeof(char))) {
       ^~~~~~~~~~~~~~
       raw_copy_from_user
cc1: some warnings being treated as errors
scripts/Makefile.build:339: recipe for target '/home/ubuntu/RaspberryPiMouse/src/drivers/rtmouse.o' failed
make[2]: *** [/home/ubuntu/RaspberryPiMouse/src/drivers/rtmouse.o] Error 1
Makefile:1552: recipe for target '_module_/home/ubuntu/RaspberryPiMouse/src/drivers' failed
make[1]: *** [_module_/home/ubuntu/RaspberryPiMouse/src/drivers] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-4.15.0-1010-raspi2'
Makefile:7: recipe for target 'rtmouse.ko' failed
make: *** [rtmouse.ko] Error 2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.