I recently notice that in my mobile phone wifi settings, there is a DLNA auto-ip option that's already checked. As its description : "Check to use DLNA when no DHCP server is available",
I found that's something the same as APIPA mechanism: "With APIPA (Automatic Private IP Addressing), DHCP clients can automatically self-configure an IP address and subnet mask when a DHCP server isn't available."
What's DLNA meant here and what are the differences between DLNA and APIPA?
Due to the DLNA specification, we have to support auto-IP when
there is no DHCP server.
"dhcpcd" is used by android and it supports auto-IP, but there are 2
designs
inside framework make auto-IP not available.
1. wireless manager timeout is the same as default DHCP discover
timeout.(30s)
2. dhcpcd will set failed property when get auto-IP
We have tried following methods to modify dhcpcd.
1. Using property system
a. When DLNA is on, set property to note its status.
b. dhcpcd reads status property. When status is on, set default DHCP
discover timeout to 10s.
c. Script reads status property. When status is on, set result
property to "ok" for IPv4LL case.
Property system is not for general applications. Thus we can not
accomplish step a.
2-1. Write status file
a. When DLNA is on, write status file in the application folder.
b. dhcpcd read status file. When status is on, set default DHCP
discover timeout to 10s.
c. script read status file. When status is on, set result property
to "ok" for IPv4LL case.
The step c is a script, if condition and file access always cause
error. So we make a change again.
2-2. Write status file and create a new reason for dhcpcd
a. When DLNA is on, write status file in the application folder.
b. dhcpcd read status file. When status is on, set default DHCP
discover timeout to 10s.
c. dhcpcd read status file. When status is on, set reason to new
created one. The case in script is alwayse set result property to
"ok".
Related
Not sure where to start on the above question.
I have systemd process (A) running with some file handling capabilities.
The requirement is to notify (A) when a file is created by another process (B) at a certain location (say /tmp/abc.txt).
Upon receiving the notification, (A) can open the file and do its parsing/caching and close it. I believe we can queue the requests if (A) is already processing something.
Is this requirement even possible? If yes, is there a traditional/systemd design pattern to go about it? If not, can this be achieved in any alternate way?
You can either use the inotify API, as Tesseract mentioned, or employ a systemd path unit (which also uses inotify under the hood):
# foo.path
[Path]
PathExists=/tmp/abc.txt
# foo.service
[Service]
ExecStart=/usr/local/bin/A
Note that this will start foo.service each time the file is created, not notify it. From your question it’s not clear to me if that’s okay for your case or not – if you want to do some operation on the file and then do nothing until the next time the file pops up, that should be fine (exit from the service and set Type=oneshot in that case).
When I try to establish a XCB connection to a given display stored in a string e.g. dpy, I know I can do it in two different ways:
Simply call xcb_connect(dpy, NULL), or
Set environment variable DISPLAY to the value of dpy and call xcb_connect(NULL, NULL).
However, if my X server requires a Xauthority file, I can only establish a XCB connection if I set environment XAUTHORITY Xauthority file path and then call xcb_connect(dpy, NULL).
I would like to establish this connection without having to set environment variable XAUTHORITY. I know there's a funcion in XCB API called xcb_connect_to_display_with_auth_info() which receives a xcb_auth_info_t struct, but I have absolutely no idea of how to build this struct given a Xauthority file path.
How could I do it?
The contents of a xcb_auth_info_t struct are the same as the parameters to XSetAuthorization.
Unfortunately, that's not well documented either.
name is the authorization method name (e.g. "MIT-MAGIC-COOKIE-1"), and data is the authentication data (e.g. a 128-bit cookie).
If you want to avoid using the XAUTHORITY env var, but have an .Xauthority file, I think you could use XauReadAuth to parse the .Xauthority file and locate the entry corresponding to the display you are connecting to, and extract the authentication method and data.
Is there a way to trigger a scan on an AP before it is initialized?
I tried to call a scan in /net/wireless/cfg.c start_ap() function, but the system hangs. What could be a better option for this? I use linux version 3.12.18
You should do that in user space; before setting the AP mode you can run a bunch of "iw" commands in a shell script to set up client mode and run a scan. Then you enter AP mode.
Once you are in AP mode you cannot trigger a multichannel scan because the clients would see the AP disappearing (from the channel were they associated).
I am designing a logger plugin for my tool.I have a busybox syslog on a target board, and i want to get syslog data from it so i can forward to my host(not via remote port forwarding of syslog) via my own communication framework.Initially i had made use of syslog's ability to forward messages it receives to a named pipe but this only works via a patch addition which is not feasible in my case.So now my idea is to write a configuration file in syslog to forward all log messages it receives to a file and track the file to get my data.I can use tail function to monitor my file changes but my busybox tail does not support "--follow" option since syslog performs logrotate which causes "tail -f" to fail.And also i am not sure if this is a good method to do it.So what i wanted to ask is there another way in which i can get modified data from a file.I can use inotify, but that can only be used to track file changes.So is there a way to do this?
You could try the "diff" utility (or git-diff, which has more facilities).
You may write a script/program which can receive an inotify event. And the script reopens the file and starts to read till EOF, from the previously saved last read file position.
Here i am looking for Testing A2DP and HFP (Hands free) Profiles.
So here in HFP i am using dbus command for sending message over dbus and execute service address of bluez. for connecting and disconnecting.
here i am using below command for audio playing in HFP.
aplay -D hw:0,1 -c 2 -f S16_LE file_name &
can you explain me what is the meaning of hw:0,1 .
HFP supports only 8000 Hz sampling rate wav files.
IN Advanced Audio Distribution Profile (A2DP) defines how the high quality audio can be streamed from one device to another over Bluetooth connection.
here i am using this command , but before this command i have to update asound.conf file.
aplay -Dplug:bluetooth file_name > /dev/null > /dev/null &
and in both case i am using same asound.conf file. which is given below.
pcm.!bluetooth {
type bluetooth
device "BD_ADDR" //bluetooth address of hands free device.
}
pcm.!default {
type plug
slave.pcm "bluetooth"
}
So i want to know the relation of this asound.conf file with HFP command and A2DP command.
Please Help me to sort out this confusion.
can you explain me what is the meaning of hw:0,1 .
The numbers after hw: stand for the sound card number and the device number. A third number can be added (hw:0,0,0) for the sub-device number, but it defaults to the next sub-device avaliable. The numbers start from zero, so, for example, to access the first device on the second sound card, you would use hw:1,0.
So i want to know the relation of this asound.conf file with HFP command and A2DP command.
asound.conf is configuration file for your PulsAudio server, normally you do not need it at all but in some cases you can setup there some specific options or behavior for your hardware. HFP and A2DP are just Bluetooth profiles which are used to communicate with your headset. You can use asound.conf to link sound from your PulsAudio server with Bluetooth device which you are pair. Which means that for example you can set default output/input to this particular BT device, that all applications in your system will use it to play and record sound.
But as I mention before normally all those things happen automatically and you do not need to do anything to make it work.
More about how to use asoundrc/asound.config you can find here: http://alsa.opensrc.org/.asoundrc