Aiyprojects-raspbian: AIY Voice Kit V2 and Arcade Button LEDs break after apt-get update/upgrade

Created on 25 May 2018  路  12Comments  路  Source: google/aiyprojects-raspbian

Similar in nature to this previous issue #223,
where by flashing the image from AIY help site to a sd card and then running ~/AIY-projects-python/src/examples/voice/assistant_grpc_demo.py the arcade button LEDs remains off/do not turn on; however, if I run ~/AIY-projects-python/src/examples/vision/leds_example.py the arcade button LEDs light up as intended.

If I update the sd card to ensure I have the latest from the AIY project as per the AIY help site, I get the same errors that plagued #223. I believe, a kernel update was pushed to stable channel which is recreating the same issues as #223 with just the standard apt-get update/upgrade commands: the leds-ktd202x driver is gone from /sys/class/leds folder and leds_example.py when run gives the following error

FileNotFoundError: [Errno 2] No such file or directory: '/sys/class/leds/ktd202x:led1/device/reset'

Two problems exist:

  • I am unsure how one can, or if it's possible to, update the deb packages while skipping an update to the kernel.

  • I followed #223 and tried to rebuild the drivers to no avail. I am unsure where to go from here, my thoughts are that the ~/drivers-raspi/leds may have a role to play, unless the leds-ktd202x driver is deprecated.

Voice

Most helpful comment

Solved

following steps below running leds_example.py should light up arcade button on the newly released voice (v2) and vision (v1.2?) kits with rpi zero w.

background
the fix
why?

background

  • v2 AIY voice kit
  • started with latest AIY image (as of now 2018-04-13) from AIY help site
  • leds_example.py worked as intended: arcade button lights up and cycles color
    (the assistant_grpc_demo.py, mult reports of no arcade button light up, so assumed arcade button leds not supposed to work in that demo)
  • via cli ran the appropriate (did NOT/do NOT use rpi-update) update commands from AIY help site
  • kernel was updated unintentionally & unwillingly, because this was a known issue #223 to break arcade LEDs
  • ran reboot cmd

the fix

once the raspberry pi finishes reboot cycle

  1. go to cd /sys/class/leds, type ls,
    if only led0 dir, then leds-ktd202 driver failed to remake and reinstall during kernel update which may be expected (discussed below)
  2. navigate to cd /usr/src/, type ls
    leds-ktd202x-1.0 dir should be listed,
    if not in dir follow step 3
    if in dir skip step 3, go to step 4
  3. to create leds-ktd202x-1.0 dir: sudo cp -r ~/drivers-raspi/leds /usr/src/leds-ktd202x-1.0 go into this newly created folder, run ls, should see these
    > dkms.conf leds-ktd202x.c Makefile make.sh
  4. run sudo dkms install leds-ktd202x-1.0
  5. when completed run sudo reboot
  6. when finished rebooting, go to cd /sys/class/leds, type ls, should see
    > ktd202x:led1 ktd202x:led2 ktd202x:led3 ktd202x:led4
  7. go to ~/AIY-projects-python/src/examples/vision, type leds_example.py
  8. arcade button lights up and cycles through color = success

why?

  • led driver, may have been accidentally left off aiy 1.1 dkms.conf, as I do not see reference to leds-ktd202x there, nor the dir leds?
    or
  • led driver may be deprecated and there was some other way to activate LEDs, but the examples weren't updated to make use of new LED driver?

All 12 comments

Solved

following steps below running leds_example.py should light up arcade button on the newly released voice (v2) and vision (v1.2?) kits with rpi zero w.

background
the fix
why?

background

  • v2 AIY voice kit
  • started with latest AIY image (as of now 2018-04-13) from AIY help site
  • leds_example.py worked as intended: arcade button lights up and cycles color
    (the assistant_grpc_demo.py, mult reports of no arcade button light up, so assumed arcade button leds not supposed to work in that demo)
  • via cli ran the appropriate (did NOT/do NOT use rpi-update) update commands from AIY help site
  • kernel was updated unintentionally & unwillingly, because this was a known issue #223 to break arcade LEDs
  • ran reboot cmd

the fix

once the raspberry pi finishes reboot cycle

  1. go to cd /sys/class/leds, type ls,
    if only led0 dir, then leds-ktd202 driver failed to remake and reinstall during kernel update which may be expected (discussed below)
  2. navigate to cd /usr/src/, type ls
    leds-ktd202x-1.0 dir should be listed,
    if not in dir follow step 3
    if in dir skip step 3, go to step 4
  3. to create leds-ktd202x-1.0 dir: sudo cp -r ~/drivers-raspi/leds /usr/src/leds-ktd202x-1.0 go into this newly created folder, run ls, should see these
    > dkms.conf leds-ktd202x.c Makefile make.sh
  4. run sudo dkms install leds-ktd202x-1.0
  5. when completed run sudo reboot
  6. when finished rebooting, go to cd /sys/class/leds, type ls, should see
    > ktd202x:led1 ktd202x:led2 ktd202x:led3 ktd202x:led4
  7. go to ~/AIY-projects-python/src/examples/vision, type leds_example.py
  8. arcade button lights up and cycles through color = success

why?

  • led driver, may have been accidentally left off aiy 1.1 dkms.conf, as I do not see reference to leds-ktd202x there, nor the dir leds?
    or
  • led driver may be deprecated and there was some other way to activate LEDs, but the examples weren't updated to make use of new LED driver?

@TrylN3rr Thank you for reporting this! We need some time to investigate. KTD driver is not deprecated and should still be working after system upgrade.

@dmitriykovalev you're welcome. In fact, it was a great learning experience as I'm fairly new to all this,
learned a bit of driver module management (dkms) and debian pkg creation (dpkg) through it all.

I have the same symptoms. I am a new python/pi user.
I was playing around and not I can't get the led to work when I run cloudspeech.py but it does work when I run leds_example.
I have been paying around a bit so I am not sure what broke things, I ran an update to install VNC (but I do not recall doing an upgrade) and then after that the voice examples were not turning on the led.

Note: As described, I did not have leds-ktd202x-1.0 and I created and installed it per the described process; but, cloudspeech.py still does not work but leds_example does.

@TrylN3rr or @dmitriykovalev can you give me some ideas on how to trace the cause. My AIY is currently broken.

I have played a bit in Python on a couple of other projects and this sort of update/version fragility seems to be inherent to Python.

@markshancock in my solved post, under background subheading point three: the assistant_grpc_demo.py, mult reports of no arcade button light up, so assumed arcade button leds not supposed to work in that demo

I believe, refers to the same issue you鈥檙e having with cloudspeech_demo.py.

As far as I can tell the demos are referencing the on board led of the voice hat (green led), and not the arcade button.

now that you mentioned this I鈥檓 trying to get arcade button leds to work for both assistant_grpc_demo and cloudspeech_demo.

@markshancock Hi, This is how I make Arcade LED works. You can have a try.

https://github.com/google/aiyprojects-raspbian/pull/386/commits/46af1268ec57a1aca88866ca1634196834833f9c

@TrylN3rr and @a54144
My perception that cloudspeech_demo.py should control the LED in the Arcade button comes from several YouTube videos that show exactly that behavior.
https://youtu.be/kCfkHkl00gg
https://youtu.be/Y8joFK2O8Es
These seem to be both for V1 rather than the V2 I have. I wonder if something changed?
I also seem to seeing the light come on before; but, that could be a false memory.
After it was pointed out that leds_example.py worked, I looked at and compared the code and noticed that they were using a different class and method. It was on my list to investigate. The whole thing does seem pretty poorly documented. One frustration is that since V2 uses a Pi Zero, you can't use the "OK Google" alert phrase (one of the original intents of the project).

As another data point, I ran a full apt update and upgrade and had the same issue: leds_example.py worked, but they didn't work when I ran assistant_grpc_demo.py.

I looked at @a54144's linked script, but found I that leds had moved below aiy.vision in the version of the code that I have.

The following snippet works for me and can be hacked-in in-place of aiy.voicehat.status_ui

import aiy.vision.leds
WHITE = (0xFF, 0xFF, 0xFF)
leds = aiy.vision.leds.Leds()
leds.update(leds.rgb_on(WHITE))

We released new SD card image with many fixes in debian package scripts. I hope previous issues should be resolved.

I had to do the same thing for the buzzer pwm - following @TrylN3rr instructions above for that module (on the Vision RPI Zero kit).

Confirming: even with most recent SD card image, if you apt-get upgrade, it'll break things due to kernel change.
running this (or some variant of this) will fix it again:
sudo dpkg-reconfigure aiy-board-info aiy-bt-prov-server aiy-cwc-server aiy-dkms aiy-io-mcu-firmware aiy-models aiy-overlay-vision aiy-overlay-voice aiy-projects-python aiy-python-wheels aiy-usb-gadget aiy-vision-dkms aiy-vision-firmware aiy-voice-services aiy-voicebonnet-soundcard-dkms leds-ktd202x-dkms pwm-soft-dkms

Was this page helpful?
0 / 5 - 0 ratings