Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
I have a setup where 2 pc with Linux is trying to communicate with RS232 Serial and Ethernet.
One of the PC, PC(B), I'm using USB<->RS232 connnector. When PC(A) issue a command for it to restart, PC(B) restarts but while booting up again, it received garbage messages at PC(A) from PC(B). PC(A) is still listening at the serial port. Some of these garbage messages happen to be what I'm listening for, which is not nice!
Anyone knows what those messages are? Is there a way to remove them? Does Centos sends some initializing message for testing purpose or what? How about other distribution of Linux?
Thanks in advance if anyone knows what is going on. =)
You can't expect a USB serial converter to be well behaved through a system restart. There's a period where the device is uninitialized, where it may produce glitches on the data lines. Any toggles on the data line will appear as garbage Rx data on A.
If you want to do what you intend, you will have to put some code on A to look for the known startup message and discard any prepended garbage bytes.
I also noticed the garbage too. After trying several baud rates, I checked the signal using an oscilloscope*. It turned out that the message is a valid output, not the result of random signals. It is sent on 9600 baud, 8N1, and it is something like a binary countdown. Specifically the following bytes are sent (in hex):
11, 10, 0F, 0E, 0D, 0C, 0B, 0A, 09, 08, 07, 06, 05, 04, 03, 02, 01, 00
These bytes are sent around the same time as when the login prompt is displayed on the (video) console. There is another very short signal sequence quite earlier in the boot process, a fast, 20 us impulse followed by a 10 us one. This sequence is too short to decide whether it is actual data or only the byproduct of some kind of switching.
I have not noticed anything on a Windows 7 desktop with a PCI serial controller card, which uses the MCS9865 chip according to its documentation.
The box is running Ubuntu 12.10. Linux kernel version is 3.5.0. The serial port controller is on a PCI Express card, lspci identifies it as "NetMos Technology PCIe 9922 Multi-I/O Controller".
It could be the BIOS. A colleague of mine noticed that his laptop gave out the BIOS version number and some more info over RS-232 at 115200 bps during bootup.
Try listening at the RS-232 at different baud rates; you may see something that makes sense.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 1 year ago.
Improve this question
**EventID 41
Version 8
Level 1
Task 63
Opcode 0
Keywords 0x8000400000000002
- TimeCreated
[ SystemTime] 2021-09-26T18:19:37.8668359Z
EventRecordID 1614
Correlation
- Execution
[ ProcessID] 4
[ ThreadID] 8
Channel System
Computer DESKTOP-IJTG7GS
- Security
[ UserID] S-1-5-18
- EventData
BugcheckCode 0
BugcheckParameter1 0x0
BugcheckParameter2 0x0
BugcheckParameter3 0x0
BugcheckParameter4 0x0
SleepInProgress 6
PowerButtonTimestamp 0
BootAppStatus 3221226017
Checkpoint 0
ConnectedStandbyInProgress false
SystemSleepTransitionsToOn 1
CsEntryScenarioInstanceId 0
BugcheckInfoFromEFI false
CheckpointStatus 0
CsEntryScenarioInstanceIdV2 0
LongPowerButtonPressDetected false**
So my computer restarts abruptly on it's own sometimes. I have tested ram and overheating issue but did not find any problem. I even installed windows again but the problem keeps on coming. Above is the event viewer critical error details. Please tell me what is the problem and how should i fix it. I am guessing it might be power supply. Just to be sure, what do you think it is.
My CPU is Intel(R) Xeon(R) CPU E3-1245 V2 # 3.40GHz 3.40 GHz it sits at 50 to 75 Celsius under load. normally its below 50. I have 20 gb ram and a 1050 ti. By the way i tested the pc after removing 1050 ti and placing quadro 4000 in it. But the problem did not solve. At one point computer would not even boot it kept on restarting at the booting screen. I don't know what to do...Help!?
Most probably it can be the PSU.
Windows Blue Screen of Death (BSOD) is a known windows error screen that appears now and then, randomly when some system drivers get corrupted, incompatible apps got installed, drivers outdated, etc. One such error is BSOD 0x8000400000000002. This error is related to kernel 41 critical error on Windows 10. And this is the same error you got. You can try:
Update the drivers: Open windows Device manager and from there you can update your drivers.
Turn off Fast Startup
Use a Restore Point, if you have one.
Unistall Recent Windows Update
Click on Start and open settings.
From settings, open Windows Update & Security option.
Then select “View Update History“
From the new page, click on “Uninstall Updates“.
Now, right-click on recently installed update and select Uninstall option.
Do uninstall all recent updates one by one and then restart your PC.
Update your BIOS
has linux reserved io port numbers for all manufactured devices.
I have devices like intel built-in network card. or another device I have for wifi (usb) from realtek.
On linux repository on github, device drivers use specific io ports to register. And kernel assign those ports to device driver. device drivers normally request for ports using call to request_region function. so for some ethernet device it requests like following
for (id_port = 0x110 ; id_port < 0x200; id_port += 0x10)
{
if (!request_region(id_port, 1, "3c509-control"))
continue;
outb(0x00, id_port);
outb(0xff, id_port);
if (inb(id_port) & 0x01)
break;
else
release_region(id_port, 1);
}
above starts with 0x110 to 0x200, any port can be assigned in this range by kernel to driver and appear in /proc/ioports file means driver is using that io port by the time of success return from request_region.
Question : So my question is has linux assigned io ports to all manufactured devices usable with kernel 5.7 or latest kernel version?
Question : What if I want to write device driver for any device. How can I find the io ports number range to request to. I dont not expect that I have to look into kernel code and find similer driver port range. so How can I find that io port number range. how to achieve this first step required in writing device driver (any device. be it wifi internet device or ethernet device)
Question : So my question is has linux assigned io ports to all manufactured devices usable with kernel 5.7 or latest kernel version?
No.
Question : What if I want to write device driver for any device. How can I find the io ports number range to request to.
You ask the user for it. After all it's the user who set them using jumpers on the ISA card.
Here's a picture of an old Sound Blaster card (taken from Wikipedia, I'm too lazy to rummage around in my basement now). I've highlighted a specific area in the picture:
That jumper header I highlighted: That's the port configuration jumper. As a user you literally connect two of the pins with a jumper connector and that connects a specific address line that comes from the card connectors to the circuitry on the rest of the card. This address line is part of the AT bus port I/O scheme. The user sets this jumper, writes down the number and then tells the driver, which number it was set to. That's how AT style I/O ports.
Or the driver uses one of the well known port numbers for specific hardware (like network controllers) that dates back to the era, where ISA style ports were still are thing. Also there's old ISA-P'n'P where the BIOS and the add-in cards would negotiate the port assignments at power up, before the OS even started. You can read those port numbers with the ISA-P'n'P API provided by the kernel.
We no longer use this kind of hardware in practice! Except for legacy and retro computing purposes.
Over a quarter of century ago, the old AT / ISA bus was superseeded with PCI. Today we use PCIe which, from the point of view of software still looks like PCI. One of the important things about PCI was, that it completely dropped the whole concept of ports.
With ISA what you had were 8 data lines and 16 address lines, plus two read/write enable lines, one for memory mapped I/O and one for port I/O. You can find the details here https://archive.is/3jjZj. But what happens when you're reading from say, port 0x0104, it would physically set the bit pattern of 0x0104 to the address lines on the ISA bus, pull low the read enable line, and then read the voltage level on the data lines. And all of that is implemented as an actual set of instructions of the x86: https://c9x.me/x86/html/file_module_x86_id_139.html
Now look at the PCI bus: There's no longer separate data and address lines. Instead read/write commands would be sent, and everything happens through memory mappings. PCI devices have something called a BAR: a Base Address Register. This is configured by the PCI root complex and assigns the hardware the region of actual physical bus addresses where it appears. The OS has to get those BAR information from the PCI root complex. The driver uses the PCI IDs to have the hardware discovered and the BAR information told to it. It can then do memory reads/writes to talk to the hardware. No I/O ports involved. And that is just the lowest level. USB and Ethernet happen a lot further up. USB is quite abstract, as is Ethernet.
Your other question Looking for driver developer datasheet of Intel(R) Core(TM) i5-2450M CPU # 2.50GHz suggests, that you have some serious misconceptions of what is actually going on. You were asking about USB devices, and Ethernet ports. Neither of those in any way directly interact with this part of the computer.
Your question per se is interesting. But we're also running into a massive XYZ problem here; it's worse than an XY problem; you're asking about X, although you want to solve Y. But Y isn't even the problem you're dealing with in the first place.
You're obviously smart, and curious, and I applaud that. But I have to tell you, that you've to backtrack quite a bit, to clear up some of the misconceptions you have.
I'm building a linux-based cashless device and trying to achieve communication with VMC in vending machines over UART directly without needing additional hardware adapter to convert between 8-bit and 9-bit frame data.
I'm only using the cashless device, no intention to connect any other peripheral to the VMC.
I read questions asked about this before, some of them stressed on the need to an adapter, others suggested possible hacks to achieve the 9-bit to 8-bit conversion, but still can't find a confirmed working and stable solution.
My question is, Is it possible (and reliable) to achieve this using a pure software solution? and how?
Thanks
Yes.
The 9th bit is a control bit. It will show if the data is to be interpreted as an address or as data. If you are communicating with one device and sending only data you want to strip the 9th bit out and only look at data frames. Check and see if it's always zero:
If controlBit = 0:
ProcessData(byte)
Else:
print("This is an address: " + byte)
EDIT:
Many people have reported that your connection will not be stable without special hardware due to timing problems.
Instead of reinventing the wheel you can use opensource code as a starting point.
https://github.com/mhaqs/vendiverse/wiki/Programming-the-VMC
This way you don't have to make the same mistakes over and over again.
Does anyone know how to reset an Advanced Card Systems NFC reader type ACR1255U-J1? I've sent an escape command to it and it got stuck. When I switch the button at the top I get a purple light for LED1 and orange light for LED2 followed by red light for LED1 and no light for LED2. Any help will be appriciated.
I can see the device through Mac Terminal when it is connected through USB but it is no longer visible when bluetooth is on.
Once the ACS1255U-J1 shows the behavior you described it's basically bricked. It happens because of a stack overflow problem (no pun intended) in the readers' firmware and ACS is currently working to correct it. I've seen it happen repeatedly with very long Escape Commands like the Rewrite Master Key Command Request (36 bytes long) as well as some shorter ones. Depending on the severity of the overflow, you may be able to resurrect the reader by reflashing it with fresh firmware. You can download all the stuff you need from our site here:
http://flomio.com/ACR1255U-J1-FlashTool/
You'll need a Win7 machine to work the tool and even then it'll take a few tries to get the reader in DFU mode. If you run into issues, post support questions on our forums and we'll be happy to help.
That said your device corruption may be beyond repair. This can happen if you've wiped out the boot sector of the flash. You'll know this if the reader fails to enter DFU mode. I've been able to resurrect a few readers but found them lacking some key setting like the serial number field being gone (all zeros). But more just don't enter DFU. We're authorized distributors of ACS products so if you want to RMA your device through us let me know and we can work something out.
UPDATE: Flomio now has the ability to repair bricked ACR1255U-J1 units. You can ping us on our forums for details.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 1 year ago.
Improve this question
Let's say I have paired and connected a Bluetooth headset successfully to my Linux system.
I know I can check my Bluetooth device MAC id from the bluetoothctl command.
Is there a way to control the Bluetooth device volume using some commands in Linux?
With this method, you need the appropriate D-Bus object path for the device to be controlled. There are a few ways of finding that (like using D-Feet), but once you have it, the following command will adjust the volume:
dbus-send --print-reply --system --dest=org.bluez /org/bluez/xxxx/yyyy/dev_zz_zz_zz_zz_zz_zz org.bluez.Control.VolumeUp
where "xxxx" seems to be the PID for bluetoothd, "yyyy" is the adapter (like "hci0"), "zz_zz_zz..." represents the MAC address of the controlled device (headset, speakers, etc.) separated by underscores, and 'VolumeUp' is replaced with 'VolumeDown' to decrease volume.
See the D-Bus documentation for more helpful on properly finding the object path. To do more than just adjust the volume, see the Bluez API documentation.
Not a proper answer, but an explanation: there are 2 different volumes for most bluetooth headsets: the software volume and the hardware volume. Traditionally on Linux you only control the software, however headsets can have an additional internal hardware volume, which is not possible to control currently. There are bug reports in place:
[BlueZ] Volume of bluetooth devices severly limited
AVRCP volume reporting for A2DP profile
If somebody knows how to control the hardware internal volume please reply below.
You can set the device's internal volume to a specific value instead of incrementing up or down using the shell:
Find the MAC address of your BT headset (we will replace colon with underscore for DBus-compatible MAC values):
$ bluetoothctl devices | sed "s/:/_/g"
Device A1_B2_C3_D4_E5_F6 Some Headset
Find the DBus object that allows control of the headset's internal volume:
$ dbus-send --system --print-reply --dest=org.bluez / org.freedesktop.DBus.ObjectManager.GetManagedObjects | less
While it is piped to less, search for the interface org.bluez.MediaTransport1 (press /, type MediaControl1, press Enter) and record the value of object path:
object path "/org/bluez/hci0/dev_A1_B2_C3_D4_E5_F6/sep1/fd0"
array [
dict entry(
string "org.bluez.MediaTransport1"
You should see a property named Volume in that block a few lines down
(if it is not present, the headset object does not support setting the volume directly):
dict entry(
string "Volume"
variant uint16 90
First get the current volume (here reported as 60):
$ dbus-send --system --print-reply --dest=org.bluez /org/bluez/hci0/dev_A1_B2_C3_D4_E5_F6/sep1/fd0 org.freedesktop.DBus.Properties.Get string:"org.bluez.MediaTransport1" string:"Volume" | grep uint16 | awk '{print $3}'
60
Let's increment the volume by ten - DO NOT GO STRAIGHT TO MAXIMUM OR LARGE VALUES as this may damage your equipment and/or your hearing.
$ dbus-send --system --dest=org.bluez /org/bluez/hci0/dev_A1_B2_C3_D4_E5_F6/sep1/fd0 org.freedesktop.DBus.Properties.Set string:"org.bluez.MediaTransport1" string:"Volume" variant:uint16:70
$ dbus-send --system --print-reply --dest=org.bluez /org/bluez/hci0/dev_A1_B2_C3_D4_E5_F6/sep1/fd0 org.freedesktop.DBus.Properties.Get string:"org.bluez.MediaTransport1" string:"Volume" | grep uint16 | awk '{print $3}'
70
On my equipment the range appears to be 0-127, with some values over 110 producing distortion. Take care with the values you supply to avoid damage.
I wanted to do device enumeration via PulseAudio as I have more than just Bluetooth devices I want to control. This relies on Sean's suggestion to use DBus to actually push the commands out to the Bluetooth devices. This script works in case you have multiple Bluetooth audio devices.
The Python library pulsectl makes finding these device identifiers easy. Sean's suggestion to use D-Feet was great to figure out the updated method name.
A mostly complete example is:
from pulsectl import Pulse
import subprocess
# diff applies to non-BT Pulse devices
diff = 0.1
method = 'org.bluez.MediaControl1.Volume{}'.format(
'Down' if diff < 0 else 'Up')
with Pulse() as pulse:
for sink in pulse.sink_list():
bluez_path = sink.proplist.get('bluez.path')
if bluez_path:
args = [
'dbus-send', '--system', '--print-reply',
'--dest=org.bluez', bluez_path, method,
]
subprocess.run(args, check=True)
else:
pulse.volume_change_all_chans(sink, diff)
I have something similar to this with diff coming from the command line, allowing relatively sane control over volume levels.
I used my i-phone to set the hardware volume in my Sony Headphones to MAX. Afterwords control for volume in Ubunto 20.04 LTS works fine.
Steps
Disconnect Blue-Tooth headphones from Ubuntu
Connect headphones to i-phone via Blue-Tooth
Open a YouTube video and adjust volume all the way up.
Disconnect headphones from i-phone
Connect Blue-Tooth headphones to your Ubuntu machine
The sound should now be fully adjustable.