Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error Trying to run Read.py without sudo on RPI 3 B+ #79

Open
obdbeats opened this issue Aug 7, 2019 · 0 comments
Open

Error Trying to run Read.py without sudo on RPI 3 B+ #79

obdbeats opened this issue Aug 7, 2019 · 0 comments

Comments

@obdbeats
Copy link

obdbeats commented Aug 7, 2019

Hi! Im getting some headhaches with this
I have been testing this code into my RPI MODEL B+ (2011) and works perfectly.
Now i have set up same code into my new RPI (3 b+ 2017) and there is the problem. (I thought upgrading to a new RPI would be much more easier)

The code:

#!/usr/bin/python
import signal
import time
import sys
import webbrowser
from pirc522 import RFID
#chrome = chromium-browser()

run = True
rdr = RFID()
util = rdr.util()
util.debug = True

def end_read(signal,frame):
    global run
    print("\nCtrl+C captured, ending read.")
    run = False
    rdr.cleanup()
    sys.exit()

signal.signal(signal.SIGINT, end_read)

print("Starting")
while run:
    rdr.wait_for_tag()

    (error, data) = rdr.request()
    if not error:
        print("\nDetected: " + format(data, "02x"))

    (error, uid) = rdr.anticoll()
    if not error:
        print("Card read UID: "+str(uid[0])+","+str(uid[1])+","+str(uid[2])+","+str(uid[3]))

        print("Setting tag")
        util.set_tag(uid)
	
	webbrowser.open('http://localhost/verperfil/rfid.php?rfid='+str(uid[0])+''+str(uid[1])+''+str(uid[2])+''+str(uid[3])+'')
        print("\nAuthorizing")
        #util.auth(rdr.auth_a, [0x12, 0x34, 0x56, 0x78, 0x96, 0x92])
        #util.auth(rdr.auth_b, [0x74, 0x00, 0x52, 0x35, 0x00, 0xFF])
        print("\nReading")
        util.read_out(4)
        print("\nDeauthorizing")
        util.deauth()

        time.sleep(1)

when i run as sudo it works almost all except the Web browser (i cannot run as ROOT)
the output:

pi@raspberrypi:~ $ sudo python /var/www/html/pi-rc522/examples/asigna.py
/usr/local/lib/python2.7/dist-packages/pi_rc522-2.2.1-py2.7.egg/pirc522/rfid.py:78: RuntimeWarning: This channel is already in use, continuing anyway.  Use GPIO.setwarnings(False) to disable warnings.
Starting
--user-data-dir --disable-quic --enable-tcp-fast-open --ppapi-flash-path=/usr/lib/chromium-browser/libpepflashplayer.so --ppapi-flash-args=enable_stagevideo_auto=0 --ppapi-flash-version=
[1975:1975:0808/005424.477659:ERROR:zygote_host_impl_linux.cc(89)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.

AND if i run without sudo get this error:

pi@raspberrypi:~ $ python /var/www/html/pi-rc522/examples/asigna.py
Traceback (most recent call last):
  File "/var/www/html/pi-rc522/examples/asigna.py", line 11, in <module>
    rdr = RFID()
  File "build/bdist.linux-armv7l/egg/pirc522/rfid.py", line 78, in __init__
RuntimeError: No access to /dev/mem.  Try running as root!

Also I've already try:
sudo chmod 777 /dev/mem
chown pi /dev/mem

HELP PLEASE!! HEELP!!

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

No branches or pull requests

1 participant