Skip to content

Conversation

@PeteLawler
Copy link
Contributor

I've taken Grizmio's patch and added some macro checks in so that at compile time the correct routines should be used.

Notes:
. Switching between kernels requires recompilation
. I have no idea what the status is on kernels between 3.8 and 4.1, I have nothing to test with and I'm way too lazy to go read the documentation - far as I know there's no recommended kernels in use from that era anyway.

@SimplicityGuy
Copy link

Awesome! Thank you for the PR... Now hopefully Adafruit will merge it.

@jwcooper
Copy link
Member

Hi! Thank you for the pull request. We'll review and test it as soon as possible and get it merged in.

@pdp7
Copy link
Collaborator

pdp7 commented May 12, 2016

I'm testing backwards compatibility of pr/96 with Debian 7.9 image with Linux 3.8.13-bone79:
Gist: PR-96_debian-7.9_linux-3.8.13-bone79_adafruit-beaglebone-io-python-test.txt

I have run into this odd error in TestPwmSetup.test_stop_pwm while running the tests:

debian@beaglebone:~/adafruit-beaglebone-io-python/test$ sudo py.test 
============================================================ test session starts =============================================================
platform linux2 -- Python 2.7.3, pytest-2.9.1, py-1.4.31, pluggy-0.3.1
rootdir: /home/debian/adafruit-beaglebone-io-python, inifile: 
collected 56 items 

test_adc.py ......
test_gpio_input.py ..
test_gpio_output.py ......
test_gpio_setup.py ..........
test_led.py ..
test_pwm_setup.py .........................E
test_spi.py ..
test_uart.py ...

=================================================================== ERRORS ===================================================================
______________________________________________ ERROR at teardown of TestPwmSetup.test_stop_pwm _______________________________________________

self = <CallInfo when='teardown' exception: [Errno 2] No such file or directory: 'P\x80"'>, func = <function <lambda> at 0x689230>
when = 'teardown'

I'm looking into it further and will update here.

@pdp7
Copy link
Collaborator

pdp7 commented May 13, 2016

Testing Pull Request 96 branch with BeagleBoard.org Debian Image 2016-01-24:

  • Debian Jessie 8.3
  • Linux 4.1.15-ti-rt-r43

The Python tests run into several errors:
https://gist.github.com/pdp7/61864034b6b8bf66a159b8e30aa868f1

I'm looking into the errors and will report back.

@pdp7
Copy link
Collaborator

pdp7 commented May 16, 2016

@PeteLawler What image are you running that this worked on?

I used:
BeagleBoard.org Debian Image 2016-01-24
Debian GNU/Linux 8.3 (jessie)
Linux beaglebone 4.1.15-ti-rt-r43

ADC example fails with:

open("/slots", O_RDWR|O_LARGEFILE) = -1 ENOENT (No such file or directory)

Details here:
https://gist.github.com/pdp7/37dee564f4b0fc0c3d6d744bc793d71d

I'm going to try some changes but just wanted to check what your experience was.

@PeteLawler
Copy link
Contributor Author

Oh hmmm seems I'm running my code on a 4.4.9-ti-r26 BeagleBoard.org Debian Image 2016-04-25
box upgraded to Stretch, could've sworn I had 4.1 Jessie on there oh well it was a rush job that I needed, not sure why I put 4.4 Stretch down.... Maybe that's the cause? I've got another box on order that should turn up later this week that'll allow me to do more pre-development work such as trying this stuff out. Once that's in I'll throw 4.1 onto it. Apologies for the noise. Hopefully we can get this sorted though rather than leaving it dangling.

@pdp7
Copy link
Collaborator

pdp7 commented May 27, 2016

The trouble I'm having seems to be that BBBVERSION41 is not being defined on 4.1.17-ti-rt-r46 due to the value of LINUX_VERSION_CODE:

root@beaglebone:~# uname -a
Linux beaglebone 4.1.17-ti-rt-r46 #1 SMP PREEMPT RT Fri Feb 5 17:13:30 UTC 2016 armv7l GNU/Linux
root@beaglebone:~# cat /etc/dogtag 
BeagleBoard.org Debian Image 2016-02-07
root@beaglebone:~# python -c "import Adafruit_BBIO.ADC as ADC; ADC.setup();"
DEBUG: LINUX_VERSION_CODE=0x31007
DEBUG: KERNEL_VERSION(4,1,0)=0x40100
DEBUG: not define BBBVERSION41
Traceback (most recent call last):
  File "<string>", line 1, in <module>
RuntimeError: Unable to setup ADC system. Possible causes are: 
  - A cape with a conflicting pin mapping is loaded 
  - A device tree object is loaded that uses the same name for a fragment: helper

It appears to be a problem with the headers that I have installed:

debian@beaglebone:~/adafruit-beaglebone-io-python$ dpkg -L linux-libc-dev |grep /version.h |xargs grep LINUX_VERSION
/usr/include/linux/version.h:#define LINUX_VERSION_CODE 200711
debian@beaglebone:~/adafruit-beaglebone-io-python$ dpkg -L linux-headers-4.1.17-ti-rt-r46 |grep /version.h |xargs grep LINUX_VERSION
/usr/src/linux-headers-4.1.17-ti-rt-r46/include/generated/uapi/linux/version.h:#define LINUX_VERSION_CODE 262417

Gist: https://gist.github.com/pdp7/193cb6252440850926297ac79ed39acc

@pdp7
Copy link
Collaborator

pdp7 commented May 29, 2016

@PeteLawler The situation I'm seeing with Debian Jessie is that linux-libc-dev package is 3.16.7-ckt25-2. I'm going to check with Robert C. Nelson if he has any ideas of how to make LINUX_VERSION_CODE reflect the actual installed kernel.

debian@beaglebone:~/adafruit-beaglebone-io-python$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 8.4 (jessie)
Release:    8.4
Codename:   jessie

debian@beaglebone:~/adafruit-beaglebone-io-python$ dpkg -l linux-libc-dev
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                                  Version                 Architecture            Description
+++-=====================================-=======================-=======================-===============================================================================
ii  linux-libc-dev:armhf                  3.16.7-ckt25-2          armhf                   Linux support headers for userspace development

debian@beaglebone:~/adafruit-beaglebone-io-python$ cat /etc/dogtag 
BeagleBoard.org Debian Image 2016-02-07

debian@beaglebone:~/adafruit-beaglebone-io-python$ dpkg -l |grep kernel |grep 4.1   
ii  linux-headers-4.1.17-ti-rt-r46        1jessie                                         armhf        Linux kernel headers for 4.1.17-ti-rt-r46 on armhf
ii  linux-image-4.1.17-ti-rt-r46          1jessie                                         armhf        Linux kernel, version 4.1.17-ti-rt-r46
ii  linux-image-4.1.25-ti-r62             1jessie                                         armhf        Linux kernel, version 4.1.25-ti-r62

@PeteLawler
Copy link
Contributor Author

@pdp7 I've not been ignoring you :) Just haven't had much to say.

I see the thread on the BeagleBone mail list and Robert's reply. He's basically saying that it comes down to an issue fixable although not in a nice way.

update deb-pkg to tie the "4.1.25-ti-r62" to via -$version here:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/scripts/package/builddeb?id=refs/tags/v4.7-rc1#n100
then just do a directory symlink like:
/usr/share/linux-libc-dev/4.1.25-ti-r62/ -> /usr/include/
(so we can easily install multiple linux-libc-dev)..
The only problem, when debian pushes a kernel update, it'll wipe
out linux-libc-dev..
....
Personally i wish Adafruit_BBIO just had a "export BUILD=4.1.x+" override

Not a fan of overrides myself, but hey. Basically I hacked this up to try and get something happening, though I am also not a fan of it being compile time setting. I think it should really be runtime to allow for kernel upgrades.

All in all, I believe this means the pull request should be rejected in the current form on the grounds that Robert describes, and that community effort should be put into a compile time override and/or runtime setting. Whether those solutions are based off this request is immaterial.

@pdp7
Copy link
Collaborator

pdp7 commented May 30, 2016

@PeteLawler I made a change to setup.py to define BBBVERSION41 based on platform.release() which does reflect the correct kernel version.

I've opened a Pull Request for your adafruit-beaglebone-io-python repo:
PeteLawler#1

@PeteLawler
Copy link
Contributor Author

@pdp7 yeah you know that spare BBB I mentioned earlier that I was getting for testing out of development production? Received it in good working order. Then managed in a moment of distinct lack of clarity to put 5v down AIN1.... Needless to say, I'm getting another organised. I'm hoping to have the development box out of its test in the next few days anyway so I'll have that back anyway.

@pdp7
Copy link
Collaborator

pdp7 commented May 31, 2016

@PeteLawler I was able to test the Adafruit_BBIO.ADC okay with both Linux 3.8, 4.1 and 4.4:
https://gist.github.com/pdp7/cf5551d2e925ac3d8f703d0f0e0f9f43

@pdp7
Copy link
Collaborator

pdp7 commented Jun 2, 2016

@jwcooper @ladyada @tdicola: I think this PR should be merged. I have tested Adafruit_BBIO.ADC okay with Linux 3.8, 4.1 and 4.4: https://gist.github.com/pdp7/cf5551d2e925ac3d8f703d0f0e0f9f43

@jwcooper jwcooper merged commit a916340 into adafruit:master Jun 2, 2016
@jwcooper
Copy link
Member

jwcooper commented Jun 2, 2016

Thanks @pdp7, @PeteLawler and everyone else that have been helping out.

@ladyada
Copy link
Member

ladyada commented Jun 2, 2016

thank you everyone!

@pdp7
Copy link
Collaborator

pdp7 commented Jun 2, 2016

Thank you @PeteLawler, @grizmio, and @SimplicityGuy!

@SimplicityGuy
Copy link

Yay! Very happy to see this merged! Thank you @PeteLawler, @pdp7, @grizmio, @jwcooper, @ladyada!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants