-
Notifications
You must be signed in to change notification settings - Fork 402
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c122387
commit 319869e
Showing
4 changed files
with
67 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/jukebox/components/rfid/hardware/generic_nfcpy/description.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
""" List of supprted devices https://nfcpy.readthedocs.io/en/latest/overview.html""" | ||
""" List of supported devices https://nfcpy.readthedocs.io/en/latest/overview.html""" | ||
# 40 chars: '========================================' | ||
DESCRIPTION = 'Generic NFCPY NFC Reader Module' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
src/jukebox/components/rfid/hardware/generic_nfcpy/setup.inc.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/bin/bash | ||
|
||
usb_devices=$(lsusb | sed -e 's/.*ID \([a-f0-9]\+:[a-f0-9]\+\).*/\1/g') | ||
|
||
has_pn533_usb=false | ||
has_port100=false | ||
|
||
for dev in $usb_devices; do | ||
if ! $has_pn533_usb && ( | ||
[ $dev = "054c:02e1" ] || # Sony RC-S330/S360/S370 | ||
[ $dev = "054c:0193" ] || # Sony/NXP PN531 reference board (Sony VID:PID) | ||
[ $dev = "072f:2200" ] || # ACS ACR122U | ||
[ $dev = "04e6:5591" ] || # Identive SCL3711 | ||
[ $dev = "04e6:5593" ] || # Identive SCL3712 | ||
[ $dev = "04cc:2533" ] || # SensorID StickID | ||
[ $dev = "04cc:0531" ] # Sony/NXP PN531 reference board (NXP VID:PID) | ||
) then | ||
has_pn533_usb=true | ||
log "Found pn53x based device" | ||
elif ! $has_port100 && ( | ||
[ $dev = "054c:06c1" ] || # Sony RC-380/S | ||
[ $dev = "054c:06c3" ] # Sony RC-380/P | ||
) then | ||
has_port100=true | ||
log "Found port100 based device" | ||
fi | ||
done | ||
|
||
file="/etc/modprobe.d/disable_driver_jukebox_nfcpy.conf" | ||
|
||
sh -c "echo > $file" | ||
if $has_pn533_usb; then | ||
rmmod pn533_usb | ||
sudo sh -c "echo 'install pn533_usb /bin/true' >> $file" | ||
fi | ||
|
||
if $has_port100; then | ||
rmmod port100 | ||
sudo sh -c "echo 'install port100 /bin/true' >> $file" | ||
fi | ||
|
||
# The following is not required for functioanlity, but informative to have in the logs | ||
if ! ($has_pn533_usb || $has_port100); then | ||
log "No nfcpy USB devices found, possible UART device" | ||
usb=$(find /dev/ -name 'ttyUSB*') | ||
acm=$(find /dev/ -name 'ttyACM*') | ||
if [ "$usb" = "" ] && [ "$acm" = "" ]; then | ||
log "No nfcpy devices found" | ||
else | ||
log "Possible UART devices: $usb $acm" | ||
fi | ||
fi |