I am using a Baytrail intel z3735 tablet. I am trying to run ubuntu 14.04/15.04 with linux kernel version 3.16/4.2.0. When I play an audio file the audio data is dumping to the audio sink but there is no audio coming from the speaker. I am able get the sound card detected as below...
sanj#sanj:~$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: bytrt5640 [byt-rt5640], device 0: Audio rt5640-aif1-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0
sanj#sanj:~$
Audio Sink nodes :
sanj#sanj:~$ pactl list sinks
Sink #0
State: SUSPENDED
Name: alsa_output.platform-byt-rt5640.analog-stereo
Description: byt-rt5640 Analog Stereo
Driver: module-alsa-card.c
Sample Specification: s16le 2ch 48000Hz
Channel Map: front-left,front-right
Owner Module: 6
Mute: no
Volume: front-left: 99957 / 153% / 11.00 dB, front-right: 99957 / 153% / 11.00 dB
balance 0.00
Base Volume: 41350 / 63% / -12.00 dB
Monitor Source: alsa_output.platform-byt-rt5640.analog-stereo.monitor
Latency: 0 usec, configured 0 usec
Flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY
Properties:
alsa.resolution_bits = "16"
device.api = "alsa"
device.class = "sound"
alsa.class = "generic"
alsa.subclass = "generic-mix"
alsa.name = ""
alsa.id = "Audio rt5640-aif1-0"
alsa.subdevice = "0"
alsa.subdevice_name = "subdevice #0"
alsa.device = "0"
alsa.card = "0"
alsa.card_name = "byt-rt5640"
alsa.long_card_name = "byt-rt5640"
alsa.driver_name = "snd_soc_sst_byt_rt5640_mach"
device.bus_path = "platform-byt-rt5640"
sysfs.path = "/devices/platform/80860F28:00/byt-rt5640/sound/card0"
device.string = "hw:0"
device.buffering.buffer_size = "96000"
device.buffering.fragment_size = "48000"
device.access_mode = "mmap+timer"
device.profile.name = "analog-stereo"
device.profile.description = "Analog Stereo"
device.description = "byt-rt5640 Analog Stereo"
module-udev-detect.discovered = "1"
device.icon_name = "audio-card"
Ports:
analog-output-speaker: Speakers (priority: 10000)
analog-output-headphones: Headphones (priority: 9000)
Active Port: analog-output-speaker
Formats:
pcm
Audio Source nodes :
sanj#sanj:~$ pactl list sources
Source #0
State: SUSPENDED
Name: alsa_output.platform-byt-rt5640.analog-stereo.monitor
Description: Monitor of byt-rt5640 Analog Stereo
Driver: module-alsa-card.c
Sample Specification: s16le 2ch 48000Hz
Channel Map: front-left,front-right
Owner Module: 6
Mute: no
Volume: front-left: 65536 / 100% / 0.00 dB, front-right: 65536 / 100% / 0.00 dB
balance 0.00
Base Volume: 65536 / 100% / 0.00 dB
Monitor of Sink: alsa_output.platform-byt-rt5640.analog-stereo
Latency: 0 usec, configured 0 usec
Flags: DECIBEL_VOLUME LATENCY
Properties:
device.description = "Monitor of byt-rt5640 Analog Stereo"
device.class = "monitor"
alsa.card = "0"
alsa.card_name = "byt-rt5640"
alsa.long_card_name = "byt-rt5640"
alsa.driver_name = "snd_soc_sst_byt_rt5640_mach"
device.bus_path = "platform-byt-rt5640"
sysfs.path = "/devices/platform/80860F28:00/byt-rt5640/sound/card0"
device.string = "0"
module-udev-detect.discovered = "1"
device.icon_name = "audio-card"
Formats:
pcm
Source #1
State: SUSPENDED
Name: alsa_input.platform-byt-rt5640.analog-stereo
Description: byt-rt5640 Analog Stereo
Driver: module-alsa-card.c
Sample Specification: s16le 2ch 48000Hz
Channel Map: front-left,front-right
Owner Module: 6
Mute: no
Volume: front-left: 93554 / 143% / 9.27 dB, front-right: 93554 / 143% / 9.27 dB
balance 0.00
Base Volume: 65536 / 100% / 0.00 dB
Monitor of Sink: n/a
Latency: 0 usec, configured 0 usec
Flags: HARDWARE DECIBEL_VOLUME LATENCY
Properties:
alsa.resolution_bits = "16"
device.api = "alsa"
device.class = "sound"
alsa.class = "generic"
alsa.subclass = "generic-mix"
alsa.name = ""
alsa.id = "Audio rt5640-aif1-0"
alsa.subdevice = "0"
alsa.subdevice_name = "subdevice #0"
alsa.device = "0"
alsa.card = "0"
alsa.card_name = "byt-rt5640"
alsa.long_card_name = "byt-rt5640"
alsa.driver_name = "snd_soc_sst_byt_rt5640_mach"
device.bus_path = "platform-byt-rt5640"
sysfs.path = "/devices/platform/80860F28:00/byt-rt5640/sound/card0"
device.string = "hw:0"
device.buffering.buffer_size = "96000"
device.buffering.fragment_size = "48000"
device.access_mode = "mmap+timer"
device.profile.name = "analog-stereo"
device.profile.description = "Analog Stereo"
device.description = "byt-rt5640 Analog Stereo"
module-udev-detect.discovered = "1"
device.icon_name = "audio-card"
Ports:
analog-input: Analog Input (priority: 10000)
Active Port: analog-input
Formats:
pcm
sanj#sanj:~$
To test whether audio is coming to sink or not, I am using pulseaudio commands paplay and parecord from different terminals. Since source 0 is the source-monitor node for sink node 0, I captured audio from it.
sanj#sanj:~$ paplay Dhaakad.wav
sanj#sanj:~$ parecord -d 0 > test.wav
Then I tested the captured audio file test.wav with audacity on a PC and it was playing fine. I am not able to figure out why the audio not coming from speaker. I also tried to change the audio settings with alsamixer but nothing worked out.
Related
I've tried to communicate my tiny Raspberry Pi Zero 2W and Raspberry Pi Pico with NRF24L01. After my researchs and tryings I decided to the projects on the internet usualy not working. After sifting through alternatives and libraries, I decided to use lib_nrf24 library at Raspberry Pi and nrf24l01.py library at Raspberry Pi Pico. When I look carefully, I saw the libraries very similar with variable names. There is some configuration parameters both of them. I tried to set the parameters in the same way in both files. And I created a sender code on Raspberry Pi Pico and create basic receiver code at Raspberry Pi Zero 2W. But it didn't work. How can I solve this issue?
Raspberry Pi Pico Code:
from machine import Pin, SPI
import struct
import time
from nrf24l01 import NRF24L01
csn = Pin(15, mode=Pin.OUT, value=1)
ce = Pin(14, mode=Pin.OUT, value=0)
pipes = (b"\xf1\xf1\xf0\xf0\xfe0", b"\xe0\xe0\xf1\xf1\xe0")
def setup():
nrf = NRF24L01(SPI(0), csn, ce, payload_size=6)
nrf.open_tx_pipe(pipes[0])
nrf.open_rx_pipe(1, pipes[1])
nrf.start_listening()
return nrf
def dataSend(nrf):
while True:
testValue = 5
print("Mesafe: ", distance, "cm")
try:
nrf.send(struct.pack("i", distance))
time.sleep(0.1)
except OSError:
print('message lost')
def auto_ack(nrf):
nrf.reg_write(0x01, 0b11111000) # enable auto-ack on all pipes
nrf = setup()
auto_ack(nrf)
dataSend(nrf)
Raspberry Pi Zero 2W Code:
import RPi.GPIO as GPIO
import time
import spidev
from lib_nrf24 import NRF24
GPIO.setmode(GPIO.BCM)
pipes = [[0xE0, 0xE0, 0xF1, 0xF1, 0xE0], [0xF1, 0xF1, 0xF0, 0xF0, 0xE0]]
radio = NRF24(GPIO,spidev.SpiDev())
radio.begin(0, 25)
radio.setPayloadSize(32)
radio.setChannel(0x05)
radio.setDataRate(NRF24.BR_1MBPS)
radio.setPALevel(NRF24.PA_MIN)
radio.openReadingPipe(1, pipes[0])
radio.printDetails()
while len(sendMessage) < 32:
sendMessage.append(0)
while True:
start = time.time()
radio.startListening()
while not radio.available(0):
time.sleep(1/100)
if time.time() - start > 2:
print("Timed out.")
break
radio.stopListening()
time.sleep(3)
Except thoose codes, when thoose codes not working I've changed some parameters in library files both of them.
**Parameters of nrf24l01.py library at Raspberry Pi Pico:
**
# nRF24L01+ registers
CONFIG = const(0x00)
EN_RXADDR = const(0x02)
SETUP_AW = const(0x03)
SETUP_RETR = const(0x04)
RF_CH = const(0x05)
RF_SETUP = const(0x06)
STATUS = const(0x07)
RX_ADDR_P0 = const(0x0A)
TX_ADDR = const(0x10)
RX_PW_P0 = const(0x11)
FIFO_STATUS = const(0x17)
DYNPD = const(0x1C)
# CONFIG register
EN_CRC = const(0x08) # enable CRC
CRCO = const(0x04) # CRC encoding scheme; 0=1 byte, 1=2 bytes
PWR_UP = const(0x02) # 1=power up, 0=power down
PRIM_RX = const(0x01) # RX/TX control; 0=PTX, 1=PRX
# RF_SETUP register
POWER_0 = const(0x00) # -18 dBm
POWER_1 = const(0x02) # -12 dBm
POWER_2 = const(0x04) # -6 dBm
POWER_3 = const(0x06) # 0 dBm
SPEED_1M = const(0x00)
SPEED_2M = const(0x08)
SPEED_250K = const(0x20)
# STATUS register
RX_DR = const(0x40) # RX data ready; write 1 to clear
TX_DS = const(0x20) # TX data sent; write 1 to clear
MAX_RT = const(0x10) # max retransmits reached; write 1 to clear
# FIFO_STATUS register
RX_EMPTY = const(0x01) # 1 if RX FIFO is empty
# constants for instructions
R_RX_PL_WID = const(0x60) # read RX payload widthx"
R_RX_PAYLOAD = const(0x61) # read RX payload
W_TX_PAYLOAD = const(0xA0) # write TX payload
FLUSH_TX = const(0xE1) # flush TX FIFO
FLUSH_RX = const(0xE2) # flush RX FIFO
NOP = const(0xFF) # use to read STATUS register
**Parameters of lib_nrf24.py library at Raspberry Pi Zero2W:
**
MAX_CHANNEL = 127
MAX_PAYLOAD_SIZE = 32
# PA Levels
PA_MIN = 0
PA_LOW = 1
PA_HIGH = 2
PA_MAX = 3
PA_ERROR = 4
# Bit rates
BR_1MBPS = 0
BR_2MBPS = 1
BR_250KBPS = 2
# CRC
CRC_DISABLED = 0
CRC_8 = 1
CRC_16 = 2
CRC_ENABLED = 3
# Registers
CONFIG = 0x00
EN_AA = 0x01
EN_RXADDR = 0x02
SETUP_AW = 0x03
SETUP_RETR = 0x04
RF_CH = 0x05
RF_SETUP = 0x06
STATUS = 0x07
OBSERVE_TX = 0x08
CD = 0x09
RX_ADDR_P0 = 0x0A
RX_ADDR_P1 = 0x0B
RX_ADDR_P2 = 0x0C
RX_ADDR_P3 = 0x0D
RX_ADDR_P4 = 0x0E
RX_ADDR_P5 = 0x0F
TX_ADDR = 0x10
RX_PW_P0 = 0x11
RX_PW_P1 = 0x12
RX_PW_P2 = 0x13
RX_PW_P3 = 0x14
RX_PW_P4 = 0x15
RX_PW_P5 = 0x16
FIFO_STATUS = 0x17
DYNPD = 0x1C
FEATURE = 0x1D
# Bit Mnemonics */
MASK_RX_DR = 6
MASK_TX_DS = 5
MASK_MAX_RT = 4
EN_CRC = 3
CRCO = 2
PWR_UP = 1
PRIM_RX = 0
ENAA_P5 = 5
ENAA_P4 = 4
ENAA_P3 = 3
ENAA_P2 = 2
ENAA_P1 = 1
ENAA_P0 = 0
ERX_P5 = 5
ERX_P4 = 4
ERX_P3 = 3
ERX_P2 = 2
ERX_P1 = 1
ERX_P0 = 0
AW = 0
ARD = 4
ARC = 0
PLL_LOCK = 4
RF_DR = 3
RF_PWR = 6
RX_DR = 6
TX_DS = 5
MAX_RT = 4
RX_P_NO = 1
TX_FULL = 0
PLOS_CNT = 4
ARC_CNT = 0
TX_REUSE = 6
FIFO_FULL = 5
TX_EMPTY = 4
RX_FULL = 1
RX_EMPTY = 0
DPL_P5 = 5
DPL_P4 = 4
DPL_P3 = 3
DPL_P2 = 2
DPL_P1 = 1
DPL_P0 = 0
EN_DPL = 2
EN_ACK_PAY = 1
EN_DYN_ACK = 0
# Instruction Mnemonics
R_REGISTER = 0x00
W_REGISTER = 0x20
REGISTER_MASK = 0x1F
ACTIVATE = 0x50
R_RX_PL_WID = 0x60
R_RX_PAYLOAD = 0x61
W_TX_PAYLOAD = 0xA0
W_ACK_PAYLOAD = 0xA8
FLUSH_TX = 0xE1
FLUSH_RX = 0xE2
REUSE_TX_PL = 0xE3
NOP = 0xFF
I changed the library parameters to be the same but still could not communicate between the two devices. I used different values with these parameters to understand where the problem is, for example, I changed the receiver and sender pipe values by crossing each other, but it still didn't work. I think the codes work well but my library RF configuration parameters are false.
I want to extract the ports for each device on the below:
index: 0
name: <alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp_5__sink>
driver: <module-alsa-card.c>
flags: HARDWARE DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
state: SUSPENDED
suspend cause: IDLE
priority: 9037
volume: front-left: 65536 / 100% / 0,00 dB, front-right: 65536 / 100% / 0,00 dB
balance 0,00
base volume: 65536 / 100% / 0,00 dB
volume steps: 65537
muted: no
current latency: 0,00 ms
max request: 0 KiB
max rewind: 0 KiB
monitor source: 0
sample spec: s16le 2ch 48000Hz
channel map: front-left,front-right
Stereo
used by: 0
linked by: 0
configured latency: 0,00 ms; range is 0,50 .. 341,00 ms
card: 0 <alsa_card.pci-0000_00_1f.3-platform-skl_hda_dsp_generic>
module: 7
properties:
alsa.resolution_bits = "16"
device.api = "alsa"
device.class = "sound"
alsa.class = "generic"
alsa.subclass = "generic-mix"
alsa.name = ""
alsa.id = "HDMI3 (*)"
alsa.subdevice = "0"
alsa.subdevice_name = "subdevice #0"
alsa.device = "5"
alsa.card = "0"
alsa.card_name = "sof-hda-dsp"
alsa.long_card_name = "DellInc.-Inspiron5490--0YMVR1"
alsa.driver_name = "snd_soc_skl_hda_dsp"
device.bus_path = "pci-0000:00:1f.3-platform-skl_hda_dsp_generic"
sysfs.path = "/devices/pci0000:00/0000:00:1f.3/skl_hda_dsp_generic/sound/card0"
device.bus = "pci"
device.vendor.id = "8086"
device.vendor.name = "Intel Corporation"
device.product.id = "02c8"
device.string = "hw:sofhdadsp,5"
device.buffering.buffer_size = "65472"
device.buffering.fragment_size = "16320"
device.access_mode = "mmap+timer"
device.profile.name = "HiFi: hw:sofhdadsp,5: sink"
device.profile.description = "HDMI3/DP3 Output"
alsa.mixer_device = "hw:sofhdadsp"
device.description = "sof-hda-dsp HDMI3/DP3 Output"
module-udev-detect.discovered = "1"
device.icon_name = "audio-card-pci"
ports:
[Out] HDMI3: HDMI3/DP3 Output (priority 700, latency offset 0 usec, available: no)
properties:
active port: <[Out] HDMI3>
index: 1
name: <alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp_4__sink>
driver: <module-alsa-card.c>
flags: HARDWARE DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
state: SUSPENDED
suspend cause: IDLE
priority: 9036
volume: front-left: 65536 / 100% / 0,00 dB, front-right: 65536 / 100% / 0,00 dB
balance 0,00
base volume: 65536 / 100% / 0,00 dB
volume steps: 65537
muted: no
current latency: 0,00 ms
max request: 0 KiB
max rewind: 0 KiB
monitor source: 1
sample spec: s16le 2ch 48000Hz
channel map: front-left,front-right
Stereo
used by: 0
linked by: 0
configured latency: 0,00 ms; range is 0,50 .. 341,00 ms
card: 0 <alsa_card.pci-0000_00_1f.3-platform-skl_hda_dsp_generic>
module: 7
properties:
alsa.resolution_bits = "16"
device.api = "alsa"
device.class = "sound"
alsa.class = "generic"
alsa.subclass = "generic-mix"
alsa.name = ""
alsa.id = "HDMI2 (*)"
alsa.subdevice = "0"
alsa.subdevice_name = "subdevice #0"
alsa.device = "4"
alsa.card = "0"
alsa.card_name = "sof-hda-dsp"
alsa.long_card_name = "DellInc.-Inspiron5490--0YMVR1"
alsa.driver_name = "snd_soc_skl_hda_dsp"
device.bus_path = "pci-0000:00:1f.3-platform-skl_hda_dsp_generic"
sysfs.path = "/devices/pci0000:00/0000:00:1f.3/skl_hda_dsp_generic/sound/card0"
device.bus = "pci"
device.vendor.id = "8086"
device.vendor.name = "Intel Corporation"
device.product.id = "02c8"
device.string = "hw:sofhdadsp,4"
device.buffering.buffer_size = "65472"
device.buffering.fragment_size = "16320"
device.access_mode = "mmap+timer"
device.profile.name = "HiFi: hw:sofhdadsp,4: sink"
device.profile.description = "HDMI2/DP2 Output"
alsa.mixer_device = "hw:sofhdadsp"
device.description = "sof-hda-dsp HDMI2/DP2 Output"
module-udev-detect.discovered = "1"
device.icon_name = "audio-card-pci"
ports:
[Out] HDMI2: HDMI2/DP2 Output (priority 600, latency offset 0 usec, available: no)
properties:
active port: <[Out] HDMI2>
index: 2
name: <alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp_3__sink>
driver: <module-alsa-card.c>
flags: HARDWARE DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
state: SUSPENDED
suspend cause: IDLE
priority: 9035
volume: front-left: 65536 / 100% / 0,00 dB, front-right: 65536 / 100% / 0,00 dB
balance 0,00
base volume: 65536 / 100% / 0,00 dB
volume steps: 65537
muted: no
current latency: 0,00 ms
max request: 0 KiB
max rewind: 0 KiB
monitor source: 2
sample spec: s16le 2ch 48000Hz
channel map: front-left,front-right
Stereo
used by: 0
linked by: 0
configured latency: 0,00 ms; range is 0,50 .. 341,00 ms
card: 0 <alsa_card.pci-0000_00_1f.3-platform-skl_hda_dsp_generic>
module: 7
properties:
alsa.resolution_bits = "16"
device.api = "alsa"
device.class = "sound"
alsa.class = "generic"
alsa.subclass = "generic-mix"
alsa.name = ""
alsa.id = "HDMI1 (*)"
alsa.subdevice = "0"
alsa.subdevice_name = "subdevice #0"
alsa.device = "3"
alsa.card = "0"
alsa.card_name = "sof-hda-dsp"
alsa.long_card_name = "DellInc.-Inspiron5490--0YMVR1"
alsa.driver_name = "snd_soc_skl_hda_dsp"
device.bus_path = "pci-0000:00:1f.3-platform-skl_hda_dsp_generic"
sysfs.path = "/devices/pci0000:00/0000:00:1f.3/skl_hda_dsp_generic/sound/card0"
device.bus = "pci"
device.vendor.id = "8086"
device.vendor.name = "Intel Corporation"
device.product.id = "02c8"
device.string = "hw:sofhdadsp,3"
device.buffering.buffer_size = "65472"
device.buffering.fragment_size = "16320"
device.access_mode = "mmap+timer"
device.profile.name = "HiFi: hw:sofhdadsp,3: sink"
device.profile.description = "HDMI1/DP1 Output"
alsa.mixer_device = "hw:sofhdadsp"
device.description = "sof-hda-dsp HDMI1/DP1 Output"
module-udev-detect.discovered = "1"
device.icon_name = "audio-card-pci"
ports:
[Out] HDMI1: HDMI1/DP1 Output (priority 500, latency offset 0 usec, available: yes)
properties:
device.product.name = "2460G5"
active port: <[Out] HDMI1>
* index: 3
name: <alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp__sink>
driver: <module-alsa-card.c>
flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
state: RUNNING
suspend cause: (none)
priority: 9032
volume: front-left: 56752 / 87% / -3,75 dB, front-right: 56752 / 87% / -3,75 dB
balance 0,00
base volume: 65536 / 100% / 0,00 dB
volume steps: 65537
muted: no
current latency: 19,83 ms
max request: 4 KiB
max rewind: 4 KiB
monitor source: 3
sample spec: s16le 2ch 48000Hz
channel map: front-left,front-right
Stereo
used by: 1
linked by: 1
configured latency: 23,22 ms; range is 0,50 .. 341,00 ms
card: 0 <alsa_card.pci-0000_00_1f.3-platform-skl_hda_dsp_generic>
module: 7
properties:
alsa.resolution_bits = "16"
device.api = "alsa"
device.class = "sound"
alsa.class = "generic"
alsa.subclass = "generic-mix"
alsa.name = ""
alsa.id = "HDA Analog (*)"
alsa.subdevice = "0"
alsa.subdevice_name = "subdevice #0"
alsa.device = "0"
alsa.card = "0"
alsa.card_name = "sof-hda-dsp"
alsa.long_card_name = "DellInc.-Inspiron5490--0YMVR1"
alsa.driver_name = "snd_soc_skl_hda_dsp"
device.bus_path = "pci-0000:00:1f.3-platform-skl_hda_dsp_generic"
sysfs.path = "/devices/pci0000:00/0000:00:1f.3/skl_hda_dsp_generic/sound/card0"
device.bus = "pci"
device.vendor.id = "8086"
device.vendor.name = "Intel Corporation"
device.product.id = "02c8"
device.string = "hw:sofhdadsp"
device.buffering.buffer_size = "65472"
device.buffering.fragment_size = "16320"
device.access_mode = "mmap+timer"
device.profile.name = "HiFi: hw:sofhdadsp: sink"
device.profile.description = "Speaker + Headphones"
alsa.mixer_device = "hw:sofhdadsp"
device.description = "sof-hda-dsp Speaker + Headphones"
module-udev-detect.discovered = "1"
device.icon_name = "audio-card-pci"
ports:
[Out] Speaker: Speaker (priority 100, latency offset 0 usec, available: unknown)
properties:
[Out] Headphones: Headphones (priority 200, latency offset 0 usec, available: yes)
properties:
active port: <[Out] Headphones>
I can get each device index with:
pacmd list-sinks | awk '/index:/ {print $0}
or with:
pacmd list-sinks | grep -e index
which results in:
index: 0
index: 1
index: 2
* index: 3
How can I go beyond that and compose commands to extract something like the lines bellow?
index: 0
ports:
[Out] HDMI3: HDMI3/DP3 Output (priority 700, latency offset 0 usec, available: no)
index: 1
ports:
[Out] HDMI2: HDMI2/DP2 Output (priority 600, latency offset 0 usec, available: no)
index: 2
ports:
[Out] HDMI1: HDMI1/DP1 Output (priority 500, latency offset 0 usec, available: yes)
* index: 3
ports:
[Out] Speaker: Speaker (priority 100, latency offset 0 usec, available: unknown)
[Out] Headphones: Headphones (priority 200, latency offset 0 usec, available: yes)
pacmd list-sinks | awk '/index/ { print } /active port:/ { pnt=0 } /ports:/ { print;pnt=1 } pnt==1 && /\[Out\]/ { print }'
Print the index line, then when we see "ports:", set a variable pnt to 1, print the line and skip to the next line. When pnt is equal to one and the line contains "[Out]", print the line. When we see "active port:" reset the pnt variable back to 0.
I am trying to collect the data from the server through SNMP.
snmpwalk does not return back any essential data as a web interface does, but I need to fetch that kind of data via SNMP.
snmpwalk -c public -v 1 <ip> .
iso.3.6.1.2.1.1.1.0 = STRING: "OCMF agent SNMP"
iso.3.6.1.2.1.1.2.0 = OID: iso.3.6.1.4.1.11606.0
iso.3.6.1.2.1.1.3.0 = Timeticks: (95236803) 11 days, 0:32:48.03
iso.3.6.1.2.1.1.4.0 = STRING: "helpdesk#pbn.com.au"
iso.3.6.1.2.1.1.5.0 = STRING: "Copyright(c)2004 Pacific Broadband Networks"
iso.3.6.1.2.1.1.6.0 = STRING: "8 Keith Campbell Court"
iso.3.6.1.2.1.1.7.0 = INTEGER: 0
iso.3.6.1.2.1.11.1.0 = Counter32: 6505
iso.3.6.1.2.1.11.2.0 = Counter32: 6580
iso.3.6.1.2.1.11.3.0 = Counter32: 127
iso.3.6.1.2.1.11.6.0 = Counter32: 41
iso.3.6.1.2.1.11.15.0 = Counter32: 225
iso.3.6.1.2.1.11.16.0 = Counter32: 6285
iso.3.6.1.2.1.11.17.0 = Counter32: 0
iso.3.6.1.2.1.11.18.0 = Counter32: 0
iso.3.6.1.2.1.11.19.0 = Counter32: 0
iso.3.6.1.2.1.11.25.0 = Counter32: 0
iso.3.6.1.2.1.11.26.0 = Counter32: 0
iso.3.6.1.2.1.11.27.0 = Counter32: 0
iso.3.6.1.2.1.11.28.0 = Counter32: 6516
iso.3.6.1.2.1.11.29.0 = Counter32: 75
iso.3.6.1.4.1.11606.1.1 = INTEGER: 1
iso.3.6.1.4.1.11606.1.2 = INTEGER: 255
iso.3.6.1.4.1.11606.1.3 = INTEGER: 0
iso.3.6.1.4.1.11606.1.4 = INTEGER: 0
iso.3.6.1.4.1.11606.1.5 = INTEGER: 0
iso.3.6.1.4.1.11606.1.6 = INTEGER: 1357399287
iso.3.6.1.4.1.11606.1.15 = INTEGER: 1357399287
End of MIB
and if I enable OID resolving in /etc/snmp/snmp.conf I get:
SNMPv2-MIB::sysDescr.0 = STRING: OCMF agent SNMP
SNMPv2-MIB::sysObjectID.0 = OID: SNMPv2-SMI::enterprises.11606.0
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (95258487) 11 days, 0:36:24.87
SNMPv2-MIB::sysContact.0 = STRING: helpdesk#pbn.com.au
SNMPv2-MIB::sysName.0 = STRING: Copyright(c)2004 Pacific Broadband Networks
SNMPv2-MIB::sysLocation.0 = STRING: 8 Keith Campbell Court
SNMPv2-MIB::sysServices.0 = INTEGER: 0
SNMPv2-MIB::snmpInPkts.0 = Counter32: 6534
SNMPv2-MIB::snmpOutPkts.0 = Counter32: 6609
SNMPv2-MIB::snmpInBadVersions.0 = Counter32: 127
SNMPv2-MIB::snmpInASNParseErrs.0 = Counter32: 41
SNMPv2-MIB::snmpInGetRequests.0 = Counter32: 225
SNMPv2-MIB::snmpInGetNexts.0 = Counter32: 6314
SNMPv2-MIB::snmpInSetRequests.0 = Counter32: 0
SNMPv2-MIB::snmpInGetResponses.0 = Counter32: 0
SNMPv2-MIB::snmpInTraps.0 = Counter32: 0
SNMPv2-MIB::snmpOutGetRequests.0 = Counter32: 0
SNMPv2-MIB::snmpOutGetNexts.0 = Counter32: 0
SNMPv2-MIB::snmpOutSetRequests.0 = Counter32: 0
SNMPv2-MIB::snmpOutGetResponses.0 = Counter32: 6545
SNMPv2-MIB::snmpOutTraps.0 = Counter32: 75
SNMPv2-SMI::enterprises.11606.1.1 = INTEGER: 1
SNMPv2-SMI::enterprises.11606.1.2 = INTEGER: 255
SNMPv2-SMI::enterprises.11606.1.3 = INTEGER: 0
SNMPv2-SMI::enterprises.11606.1.4 = INTEGER: 0
SNMPv2-SMI::enterprises.11606.1.5 = INTEGER: 0
SNMPv2-SMI::enterprises.11606.1.6 = INTEGER: 1357399287
SNMPv2-SMI::enterprises.11606.1.15 = INTEGER: 1357399287
End of MIB
I would like to fetch the same set of parameter as available in web interface
1.MTEMP 30C O
1.LCUR 61mA O
1.LPWR 09.9mW Z
1.OMI 04.2% Z
1.ERF 20.5dBmV O
1.RFI 41.9dBmV O
1.RFO 36.6dBmV Z
1.LTEMP 31C O
Is this possible?
The dump you've provided as a result of snmpwalk command is just a snapshot of RFC1213 (mib-2) data. And yes your assumptions are correct: It is not the information you're interested in as it only contains the set of data about network interfaces and common system information (system group of MIB-II). You'll need to contact your vendor to get specific set of MIB files for this particular device. Usually the target MIB files are available on vendor's web site in Download area. The data you'd like to retrieve is usually located in private enterprise specific branch of MIB tree.
From what I see the Enterprise OID 1.3.6.1.4.1.11606 belongs to Pacific Broadband Networks (PBN).
Also I've found the definition for the root element of this MIB module:
PBN-ROOT DEFINITIONS ::= BEGIN
IMPORTS
enterprises
FROM RFC1155-SMI;
pbn OBJECT IDENTIFIER ::= { enterprises 11606 }
END
I have connected a MCP23017 I2C GPIO Expander chip to RPi. I use the this device driver and the mcp23017.dtbo overlay file.
I am trying to check the interrupt handling with the gpio pins. I did the following to connect the pins to interrupt(496 is the base which is GPA0 of MCP23017):
echo "496" > /sys/class/gpio/export
echo "both" > /sys/class/gpio/gpio496/edge
and then to trigger:
cat gpio496/value
But when i check /proc/interrupts it always shows 0 interrupts:
root#raspberrypi:/sys/class/gpio# cat /proc/interrupts
CPU0 CPU1 CPU2 CPU3
16: 0 0 0 0 bcm2836-timer 0 Edge arch_timer
17: 41827 52799 8260 86838 bcm2836-timer 1 Edge arch_timer
23: 67 0 0 0 ARMCTRL-level 1 Edge 3f00b880.mailbox
24: 248 0 0 0 ARMCTRL-level 2 Edge VCHIQ doorbell
46: 0 0 0 0 ARMCTRL-level 48 Edge bcm2708_fb dma
48: 4125 0 0 0 ARMCTRL-level 50 Edge DMA IRQ
50: 0 0 0 0 ARMCTRL-level 52 Edge DMA IRQ
62: 415706 0 0 0 ARMCTRL-level 64 Edge dwc_otg, dwc_otg_pcd, dwc_otg_hcd:usb1
79: 0 0 0 0 ARMCTRL-level 81 Edge 3f200000.gpio:bank0
80: 0 0 0 0 ARMCTRL-level 82 Edge 3f200000.gpio:bank1
83: 945 0 0 0 ARMCTRL-level 85 Edge 3f804000.i2c
86: 502 0 0 0 ARMCTRL-level 88 Edge mmc0
87: 5032 0 0 0 ARMCTRL-level 89 Edge uart-pl011
92: 6828 0 0 0 ARMCTRL-level 94 Edge mmc1
170: 0 0 0 0 pinctrl-bcm2835 4 Edge 1-0020, 1-0021, 1-0022, 1-0023
220: 0 0 0 0 gpio-mcp23xxx 0 Edge gpiolib
Also, when the overlay is loaded, the probe funtion is called and i get the following message:
genirq: irq 170 uses trigger mode 8; requested 2
I could not figure out the problem. I am not sure if there is something wrong in the overlay file. Below is the .dts overlay file:
// Definitions for MCP23017 Gpio Extender from Microchip Semiconductor
/dts-v1/;
/plugin/;
/ {
compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709";
fragment#0 {
target = <&i2c1>;
__overlay__ {
status = "okay";
};
};
fragment#1 {
target = <&gpio>;
__overlay__ {
mcp23017_pins: mcp23017_pins {
brcm,pins = <4>;
brcm,function = <0>;
};
};
};
fragment#2 {
target = <&i2c1>;
__overlay__ {
#address-cells = <1>;
#size-cells = <0>;
mcp20:mcp23017#20 {
compatible = "microchip,mcp23017";
reg = <0x20>;
gpio-controller;
#gpio-cells = <2>;
interrupt-parent = <&gpio>;
interrupts = <4 2>;
interrupt-controller;
#interrupt-cells=<2>;
microchip,irq-mirror;
status = "okay";
};
};
};
__overrides__ {
gpiopin = <&mcp23017_pins>,"brcm,pins:0",
<&mcp20>,"interrupts:0";
addr = <&mcp20>,"reg:0";
};
};
The settings i have applied in my sysctl.conf are not working. Not on reboot or after applying it using sysctl -p
Below are my sysctl.conf settings. Can someone take a look and tell me what may be causing the issue?
# Controls IP packet forwarding
net.ipv4.ip_forward = 0
# Controls source route verification
net.ipv4.conf.default.rp_filter = 1
# Do not accept source routing
net.ipv4.conf.default.accept_source_route = 0
# Controls the System Request debugging functionality of the kernel
kernel.sysrq = 0
# Controls whether core dumps will append the PID to the core filename.
# Useful for debugging multi-threaded applications.
kernel.core_uses_pid = 1
# Controls the use of TCP syncookies
net.ipv4.tcp_syncookies = 1
# Controls the default maxmimum size of a mesage queue
kernel.msgmnb = 65536
# Controls the maximum size of a message, in bytes
kernel.msgmax = 65536
# Controls the maximum shared segment size, in bytes
kernel.shmmax = 68719476736
# Controls the maximum number of shared memory segments, in pages
kernel.shmall = 4294967296
net.ipv4.tcp_keepalive_time = 4
net.ipv4.tcp_keepalive_probes = 1
net.ipv4.tcp_keepalive_intvl = 2
net.ipv4.tcp_fin_timeout = 4
net.ipv4.tcp_no_metrics_save = 1
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_rfc1337 = 1
net.ipv4.tcp_congestion_control= cubic
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.route.flush = 1
net.ipv4.tcp_orphan_retries = 0
net.core.netdev_max_backlog = 400000
net.core.optmem_max = 10000000
net.core.rmem_default = 10000000
net.core.rmem_max = 10000000
net.core.somaxconn = 100000
net.core.wmem_default = 10000000
net.core.wmem_max = 10000000
net.ipv4.conf.all.rp_filter = 1
net.ipv4.ip_local_port_range = 1024 65535
net.ipv4.tcp_ecn = 0
net.ipv4.tcp_max_syn_backlog = 12000
net.ipv4.tcp_max_tw_buckets = 2000000
net.ipv4.tcp_mem = 10240 8738000 825829120
net.ipv4.tcp_rmem = 10240 8738000 825829120
net.ipv4.tcp_sack = 1
net.ipv4.tcp_timestamps = 1
net.ipv4.tcp_wmem = 10240 8738000 825829120
net.netfilter.nf_conntrack_max = 768000
net.netfilter.nf_conntrack_generic_timeout = 4
net.netfilter.nf_conntrack_tcp_timeout_established = 4
net.netfilter.nf_conntrack_tcp_timeout_time_wait = 4
net.netfilter.nf_conntrack_tcp_timeout_fin_wait = 4
net.netfilter.nf_conntrack_tcp_timeout_close_wait = 4
net.netfilter.nf_conntrack_tcp_timeout_last_ack = 4
net.netfilter.nf_conntrack_tcp_timeout_syn_sent = 4
net.netfilter.nf_conntrack_tcp_timeout_syn_recv = 4
net.netfilter.nf_conntrack_tcp_timeout_close = 4