Giter Site home page Giter Site logo

tagtagtag-ears's Introduction

tagtagtag-ears

Linux driver for tagtagtag ears

Creates /dev/ear0 (left) and /dev/ear1 (right) to drive tagtagtag ears.

Installation

make
sudo make install

This adds:

dtoverlay=tagtagtag-ears

to /boot/config.txt

reboot

Usage

A single process can open /dev/ear0 (resp. /dev/ear1). Any further access will fail with EBUSY.

The following commands are accepted:

  • '.' NOP
  • '+' <count> Move ear steps forwards (count from 0 to 255)

Example:

echo -n -e '+\x03' > /dev/ear0

will move the ear 3 steps forward

  • '-' <count> Move ear steps backwards (count from 0 to 255)

Example:

echo -n -e '-\x03' > /dev/ear0

will move the ear 3 steps backward

  • '>' <position> Move ear forward until % 17 is reached. If position > 17, perform additional turns. If position is unknown, perform a detection running forward.

Example:

echo -n -e '>\x03' > /dev/ear0

will move the ear forward to position "3" (3 steps after missing hole).

  • '<' <position> Move ear backward until % 17 is reached. If position > 17, perform additional turns. If position is unknown, perform a detection running backward.

Example:

echo -n -e '<\x03' > /dev/ear0

will move the ear forward to position "3" (3 steps after missing hole).

  • '?' Get position or -1 if unknown (to be read from device)

Example:

echo -n -e '>\x03?' > /dev/ear0 && dd if=/dev/ear0 of=/dev/stdout count=1 bs=1

will output '\x03' after ear has been moved to position 3.

  • '!' Get position, running a position detection if required.

Detecting user moves and blocking I/O

Detecting user moves is achieved by reading /dev/ear*. Read blocks until ear is moved (it will then return 'm') or a get position command is invoked. Once a 'm' is read, it will block until an additional movement occurs. Any command clears the buffer.

Writing will block if the ear is not idle. Most command will set the ear in a non-idle state, thus '.' can be used to block until the command ends. Compare:

 echo -n -e '+\x0A' > /dev/ear0

with:

 echo -n -e '+\x0A.' > /dev/ear0

The first line returns immediatly. The second line blocks until the ear moved the requested steps.

Broken ears

Ears are tested on start-up (ears perform a full turn which is also used to determine ear position). If, at any time, no rising GPIO interrupt is received within 3 seconds, the ear is considered broken. Any further write will fail. Reading will return EOF.

tagtagtag-ears's People

Contributors

pguyot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

tagtagtag-ears's Issues

Driver build fails with kernel 5.15.xx

/usr/bin/git pull -v
From https://github.com/pguyot/tagtagtag-ears
 = [up to date]      release    -> origin/release
 = [up to date]      master     -> origin/master
Already up to date.
Building tagtagtag-ears driver for kernel 5.15.30+.
/usr/bin/make KERNELRELEASE=5.15.30+ clean && /usr/bin/make KERNELRELEASE=5.15.30+ && /usr/bin/sudo /usr/bin/make KERNELRELEASE=5.15.30+ install && /usr/bin/make KERNELRELEASE=5.15.30+ clean
make -C /lib/modules/5.15.30+/build M=/home/pi/tagtagtag-ears clean
make[1]: Entering directory '/usr/src/linux-headers-5.15.30+'
make[1]: Leaving directory '/usr/src/linux-headers-5.15.30+'
make -C /lib/modules/5.15.30+/build M=/home/pi/tagtagtag-ears modules
make[1]: Entering directory '/usr/src/linux-headers-5.15.30+'
  CC [M]  /home/pi/tagtagtag-ears/tagtagtag-ears.o
  MODPOST /home/pi/tagtagtag-ears/Module.symvers
  CC [M]  /home/pi/tagtagtag-ears/tagtagtag-ears.mod.o
  LD [M]  /home/pi/tagtagtag-ears/tagtagtag-ears.ko
make[1]: Leaving directory '/usr/src/linux-headers-5.15.30+'
make: *** No rule to make target 'tagtagtag-ears.dtbo', needed by 'install'.  Stop.

Ears driver behaviour on Pi Zero 2 (armv7l)

On Pi Zero 2 platform running a 32 bit (armv7l) image, ear movements flood kernel log with traces below.
There is no problem with ear behaviour, which appears to be fine.

But the repeated writes to /var/log/kern.log /var/log/messages on the SD card makes the behaviour of the zero2_raspios Pynab image somewhat sluggish.
There is no such adverse effect with the zero2_dietpi image, where logs are generated in RAM and quickly rotated.

Mar  5 22:08:40 Hazel kernel: [  236.393041] WARNING: CPU: 0 PID: 0 at kernel/time/timer.c:1372 del_timer_sync+0x50/0x64
Mar  5 22:08:40 Hazel kernel: [  236.393049] Modules linked in: cmac algif_hash aes_arm_bs crypto_simd cryptd algif_skcipher af_alg bnep hci_uart btbcm bluetooth ecdh_generic ecc lz4 lz4_compress zram zsmalloc 8021q garp stp llc cr14(O) snd_soc_wm8960(O) regmap_i2c snd_soc_hdmi_codec brcmfmac brcmutil sha256_generic vc4 cfg80211 cec rfkill raspberrypi_hwmon drm_kms_helper snd_soc_volume_gpio(O) syscopyarea snd_soc_simple_card sysfillrect tagtagtag_ears(O) snd_soc_simple_card_utils sysimgblt fb_sys_fops bcm2835_codec(C) bcm2835_v4l2(C) v4l2_mem2mem bcm2835_isp(C) i2c_bcm2835 bcm2835_mmal_vchiq(C) videobuf2_dma_contig videobuf2_vmalloc videobuf2_memops videobuf2_v4l2 videobuf2_common snd_soc_bcm2835_i2s videodev snd_soc_pcm5102a snd_soc_max9759(O) mc vc_sm_cma(C) snd_soc_core snd_compress snd_pcm_dmaengine snd_pcm snd_timer snd uio_pdrv_genirq fixed uio drm fuse drm_panel_orientation_quirks backlight ip_tables x_tables ipv6
Mar  5 22:08:40 Hazel kernel: [  236.393513] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G        WC O      5.10.92-v7+ #1514
Mar  5 22:08:40 Hazel kernel: [  236.393520] Hardware name: BCM2835
Mar  5 22:08:40 Hazel kernel: [  236.393529] Backtrace:
Mar  5 22:08:40 Hazel kernel: [  236.393556] [<809f4a58>] (dump_backtrace) from [<809f4de8>] (show_stack+0x20/0x24)
Mar  5 22:08:40 Hazel kernel: [  236.393572]  r7:ffffffff r6:00000000 r5:60000193 r4:80fe5ef0
Mar  5 22:08:40 Hazel kernel: [  236.393591] [<809f4dc8>] (show_stack) from [<809f8ffc>] (dump_stack+0xcc/0xf8)
Mar  5 22:08:40 Hazel kernel: [  236.393611] [<809f8f30>] (dump_stack) from [<8011eea0>] (__warn+0xfc/0x114)
Mar  5 22:08:40 Hazel kernel: [  236.393629]  r10:80f01da8 r9:00000009 r8:801a5e6c r7:0000055c r6:00000009 r5:801a5e6c
Mar  5 22:08:40 Hazel kernel: [  236.393639]  r4:80d02910 r3:80f05050
Mar  5 22:08:40 Hazel kernel: [  236.393656] [<8011eda4>] (__warn) from [<809f5438>] (warn_slowpath_fmt+0x70/0xd8)
Mar  5 22:08:40 Hazel kernel: [  236.393670]  r7:0000055c r6:80d02910 r5:80f05008 r4:00000000
Mar  5 22:08:40 Hazel kernel: [  236.393689] [<809f53cc>] (warn_slowpath_fmt) from [<801a5e6c>] (del_timer_sync+0x50/0x64)
Mar  5 22:08:40 Hazel kernel: [  236.393706]  r9:ffffe000 r8:000000c7 r7:82be8a00 r6:82fff490 r5:00000000 r4:82fff490
Mar  5 22:08:40 Hazel kernel: [  236.393732] [<801a5e1c>] (del_timer_sync) from [<7f257ff4>] (tagtagtagear_irq_handler+0xe4/0x690 [tagtagtag_ears])
Mar  5 22:08:40 Hazel kernel: [  236.393743]  r5:00000000 r4:82fff448
Mar  5 22:08:40 Hazel kernel: [  236.393769] [<7f257f10>] (tagtagtagear_irq_handler [tagtagtag_ears]) from [<80185fc0>] (__handle_irq_event_percpu+0xa8/0x268)
Mar  5 22:08:40 Hazel kernel: [  236.393787]  r9:ffffe000 r8:000000c7 r7:82be8a00 r6:00000000 r5:82be8a6c r4:831e6c00
Mar  5 22:08:40 Hazel kernel: [  236.393806] [<80185f18>] (__handle_irq_event_percpu) from [<801861bc>] (handle_irq_event_percpu+0x3c/0x90)
Mar  5 22:08:40 Hazel kernel: [  236.393823]  r10:80cfcf84 r9:80f00000 r8:814de000 r7:80f05008 r6:82be8a00 r5:82be8a6c
Mar  5 22:08:40 Hazel kernel: [  236.393832]  r4:80f05008
Mar  5 22:08:40 Hazel kernel: [  236.393851] [<80186180>] (handle_irq_event_percpu) from [<80186264>] (handle_irq_event+0x54/0x78)
Mar  5 22:08:40 Hazel kernel: [  236.393864]  r6:81cac840 r5:82be8a6c r4:82be8a00
Mar  5 22:08:40 Hazel kernel: [  236.393882] [<80186210>] (handle_irq_event) from [<8018b1a4>] (handle_edge_irq+0xcc/0x1fc)
Mar  5 22:08:40 Hazel kernel: [  236.393896]  r7:80f05008 r6:81cac840 r5:00000000 r4:82be8a00
Mar  5 22:08:40 Hazel kernel: [  236.393914] [<8018b0d8>] (handle_edge_irq) from [<80184f7c>] (generic_handle_irq+0x44/0x54)
Mar  5 22:08:40 Hazel kernel: [  236.393925]  r5:00000000 r4:00000018
Mar  5 22:08:40 Hazel kernel: [  236.393946] [<80184f38>] (generic_handle_irq) from [<80680de8>] (bcm2835_gpio_irq_handle_bank+0x94/0xcc)
Mar  5 22:08:40 Hazel kernel: [  236.393965] [<80680d54>] (bcm2835_gpio_irq_handle_bank) from [<80680eb0>] (bcm2835_gpio_irq_handler+0x90/0x124)
Mar  5 22:08:40 Hazel kernel: [  236.393979]  r7:81cac840 r6:00000000 r5:80fe5fb4 r4:814e9618
Mar  5 22:08:40 Hazel kernel: [  236.393998] [<80680e20>] (bcm2835_gpio_irq_handler) from [<80184f7c>] (generic_handle_irq+0x44/0x54)
Mar  5 22:08:40 Hazel kernel: [  236.394011]  r7:00000001 r6:00000000 r5:00000000 r4:80f05aec
Mar  5 22:08:40 Hazel kernel: [  236.394032] [<80184f38>] (generic_handle_irq) from [<806786bc>] (bcm2836_chained_handle_irq+0x48/0x4c)
Mar  5 22:08:40 Hazel kernel: [  236.394051] [<80678674>] (bcm2836_chained_handle_irq) from [<80184f7c>] (generic_handle_irq+0x44/0x54)
Mar  5 22:08:40 Hazel kernel: [  236.394062]  r5:00000000 r4:80e91d90
Mar  5 22:08:40 Hazel kernel: [  236.394081] [<80184f38>] (generic_handle_irq) from [<801856dc>] (__handle_domain_irq+0x6c/0xc4)
Mar  5 22:08:40 Hazel kernel: [  236.394100] [<80185670>] (__handle_domain_irq) from [<801012c8>] (bcm2836_arm_irqchip_handle_irq+0x60/0x64)
Mar  5 22:08:40 Hazel kernel: [  236.394117]  r9:80f00000 r8:00000001 r7:80f01f04 r6:ffffffff r5:60000013 r4:80108874
Mar  5 22:08:40 Hazel kernel: [  236.394134] [<80101268>] (bcm2836_arm_irqchip_handle_irq) from [<80100abc>] (__irq_svc+0x5c/0x7c)
Mar  5 22:08:40 Hazel kernel: [  236.394145] Exception stack(0x80f01ed0 to 0x80f01f18)
Mar  5 22:08:40 Hazel kernel: [  236.394158] 1ec0:                                     00000000 000446cc 9ef16344 80119040
Mar  5 22:08:40 Hazel kernel: [  236.394174] 1ee0: ffffe000 80f05058 80f050a0 00000001 00000001 8103193f 80cfcf84 80f01f2c
Mar  5 22:08:40 Hazel kernel: [  236.394189] 1f00: 80f01f30 80f01f20 80108870 80108874 60000013 ffffffff
Mar  5 22:08:40 Hazel kernel: [  236.394211] [<8010882c>] (arch_cpu_idle) from [<80a03958>] (default_idle_call+0x4c/0x118)
Mar  5 22:08:40 Hazel kernel: [  236.394229] [<80a0390c>] (default_idle_call) from [<8015664c>] (do_idle+0x118/0x168)
Mar  5 22:08:40 Hazel kernel: [  236.394246] [<80156534>] (do_idle) from [<80156970>] (cpu_startup_entry+0x28/0x30)
Mar  5 22:08:40 Hazel kernel: [  236.394263]  r10:9efffb40 r9:80e52a58 r8:00000000 r7:80e52a58 r6:80f05000 r5:80f05008
Mar  5 22:08:40 Hazel kernel: [  236.394274]  r4:000000d9 r3:80e87284
Mar  5 22:08:40 Hazel kernel: [  236.394290] [<80156948>] (cpu_startup_entry) from [<809fc990>] (rest_init+0xbc/0xc4)
Mar  5 22:08:40 Hazel kernel: [  236.394310] [<809fc8d4>] (rest_init) from [<80e00aa0>] (arch_call_rest_init+0x18/0x1c)
Mar  5 22:08:40 Hazel kernel: [  236.394321]  r5:80f05008 r4:81049068
Mar  5 22:08:40 Hazel kernel: [  236.394339] [<80e00a88>] (arch_call_rest_init) from [<80e01068>] (start_kernel+0x54c/0x580)
Mar  5 22:08:40 Hazel kernel: [  236.394354] [<80e00b1c>] (start_kernel) from [<00000000>] (0x0)
Mar  5 22:08:40 Hazel kernel: [  236.394363] ---[ end trace aca72aa80d46d946 ]---

Script sh tout simple

Bonjour Paul

J'essaie de faire 2 script bash tout simple

  • l'un qui met les oreilles à l'horizontale
  • l'autre qui fait faire 3/4 de tour

Je ne comprend pas les exemples, en les testant (ils fonctionnent sur mon lapin), les oreilles tournent plusieurs fois même sur une commande simple de tourner de +3 positions par exemples. Qu'est ce que je ne comprend pas ?

Merci

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.