Delphi Indy 10 client has 10 second delay when upgrading from 10.2 to 10.4 - indy10

Our company develops a Point of Sale system that supports various credit card transation providers. It has a JavaScript web client front end and a Delphi server back end. It uses Indy 10 heavily for HTTP communication.
One of our platforms we support is Adyen. I have developed a plugin that uses Indy 10's HTTP client to connect to an Adyen EFT device running a server which performs credit card transactions, communicating with a back end server on the WWW. I have this working reliably in Delphi 10.2. This year we upgraded to Delphi 10.4, and I find that there is now a considerable delay in the response time of Indy 10 requests to the device, on the order of 10 seconds per request.
Using the OnWorkBegin, OnWork and OnWorkEnd events (with handler methods named HTTPWorkBegin, HTTPWork, and HTTPWorkEnd respectively), I was able to log the timing of the request in Delphi 10.4. From this I discovered that a 10 second delay (nearly to the millisecond) occurs on the request read between the end of the HTTPWork method and the beginning of the HTTPWorkEnd method.
2021.08.12.16.13.36.889 [ 5940] +Info | https://10.50.100.53:8443/nexo/
2021.08.12.16.13.36.890 [ 5940] +Info | POST begin
2021.08.12.16.13.38.904 [ 5940] >Enter | TAdyenDisplay.HTTPWorkBegin
2021.08.12.16.13.38.930 [ 5940] #Debug | WorkMode = Write; WorkCountMax = 1146
2021.08.12.16.13.38.931 [ 5940] <Exit | TAdyenDisplay.HTTPWorkBegin
2021.08.12.16.13.38.932 [ 5940] >Enter | TAdyenDisplay.HTTPWork
2021.08.12.16.13.38.933 [ 5940] #Debug | WorkMode = Write; WorkCount = 1146
2021.08.12.16.13.38.933 [ 5940] <Exit | TAdyenDisplay.HTTPWork
2021.08.12.16.13.38.934 [ 5940] >Enter | TAdyenDisplay.HTTPWorkEnd
2021.08.12.16.13.38.935 [ 5940] #Debug | WorkMode = Write
2021.08.12.16.13.38.936 [ 5940] <Exit | TAdyenDisplay.HTTPWorkEnd
2021.08.12.16.13.39.221 [ 5940] >Enter | TAdyenDisplay.HTTPWorkBegin
2021.08.12.16.13.39.222 [ 5940] #Debug | WorkMode = Read; WorkCountMax = 0
2021.08.12.16.13.39.223 [ 5940] <Exit | TAdyenDisplay.HTTPWorkBegin
2021.08.12.16.13.39.223 [ 5940] >Enter | TAdyenDisplay.HTTPWork
2021.08.12.16.13.39.224 [ 5940] #Debug | WorkMode = Read; WorkCount = 973
2021.08.12.16.13.39.225 [ 5940] <Exit | TAdyenDisplay.HTTPWork ---ten second delay--
2021.08.12.16.13.49.220 [ 5940] >Enter | TAdyenDisplay.HTTPWorkEnd
2021.08.12.16.13.49.221 [ 5940] #Debug | WorkMode = Read
2021.08.12.16.13.49.222 [ 5940] <Exit | TAdyenDisplay.HTTPWorkEnd
2021.08.12.16.13.49.223 [ 5940] +Info | POST end
2021.08.12.16.13.49.223 [ 5940] +Info | Elapsed Time: 12 seconds
Comparing this to the same request running in Delphi 10.2, the log indicates no delay:
2021.08.13.17.24.40.916 [9724] Information https://10.50.100.53:8443/nexo/
2021.08.13.17.24.40.917 [9724] Information POST begin
2021.08.13.17.24.42.373 [9724] >> Entry >> TAdyenDisplay.HTTPWorkBegin
2021.08.13.17.24.42.373 [9724] Information WorkMode = Write; WorkCountMax = 1146
2021.08.13.17.24.42.374 [9724] << Exit << TAdyenDisplay.HTTPWorkBegin
2021.08.13.17.24.42.374 [9724] >> Entry >> TAdyenDisplay.HTTPWork
2021.08.13.17.24.42.375 [9724] Information WorkMode = Write; WorkCount = 1146
2021.08.13.17.24.42.375 [9724] << Exit << TAdyenDisplay.HTTPWork
2021.08.13.17.24.42.376 [9724] >> Entry >> TAdyenDisplay.HTTPWorkEnd
2021.08.13.17.24.42.376 [9724] Information WorkMode = Write
2021.08.13.17.24.42.377 [9724] << Exit << TAdyenDisplay.HTTPWorkEnd
2021.08.13.17.24.42.506 [9724] >> Entry >> TAdyenDisplay.HTTPWorkBegin
2021.08.13.17.24.42.507 [9724] Information WorkMode = Read; WorkCountMax = 0
2021.08.13.17.24.42.508 [9724] << Exit << TAdyenDisplay.HTTPWorkBegin
2021.08.13.17.24.42.559 [9724] >> Entry >> TAdyenDisplay.HTTPWork
2021.08.13.17.24.42.559 [9724] Information WorkMode = Read; WorkCount = 975
2021.08.13.17.24.42.560 [9724] << Exit << TAdyenDisplay.HTTPWork
--no significant delay--
2021.08.13.17.24.42.561 [9724] >> Entry >> TAdyenDisplay.HTTPWorkEnd
2021.08.13.17.24.42.561 [9724] Information WorkMode = Read
2021.08.13.17.24.42.562 [9724] << Exit << TAdyenDisplay.HTTPWorkEnd
2021.08.13.17.24.42.562 [9724] Information POST end
2021.08.13.17.24.42.563 [9724] Information Elapsed Time: 1 seconds
I am baffled what could be the difference. Any ideas would be appreciated.

Related

Linux RTC PCF85063A issue after suspend/resume

I am trying to use the PCF85063A RTC device on a Toradex Colibry i.MX7D processor.
Used Setup:
Colibri iMX7D 1 GB V1.1A
Kernel 5.4.161-5.6.0-devel+git.0f0011824921
For this, I created an own DTS file. Here’s the relevant DTS change:
&i2c4 {
status = "okay";
/* PCF85063A real time clock on carrier board */
pcf_rtc: pcf85063a#51 {
compatible = "nxp,pcf85063a";
reg = <0x51>;
interrupt-parent = <&gpio1>;
interrupts = <1 IRQ_TYPE_EDGE_FALLING>;
wakeup-source;
};
};
I enabled the driver in the kernel configuration, recompiled the kernel and modules and deployed them.
CONFIG_RTC_DRV_PCF85063=y
The output of dmesg after booting the system is as follows, which looks good to me at first glance:
~$ dmesg | grep rtc
[ 1.071396] rtc-pcf85063 3-0051: wake irq already initialized
[ 1.293186] rtc rtc0: failed to enable irq wake
[ 1.303787] rtc-pcf85063 3-0051: registered as rtc0
[ 1.309405] snvs_rtc 30370000.snvs:snvs-rtc-lp: registered as rtc1
[ 1.757462] rtc-pcf85063 3-0051: setting system clock to 2022-11-28T15:33:09 UTC (1669649589)
But one block within dmesg output makes me think that something is wrong initialized:
[ 1.056406] ------------[ cut here ]------------
[ 1.061047] WARNING: CPU: 0 PID: 1 at drivers/base/power/wakeirq.c:30 dev_pm_attach_wake_irq.constprop.0+0xd0/0xd4
[ 1.071396] rtc-pcf85063 3-0051: wake irq already initialized
[ 1.077140] Modules linked in:
[ 1.080203] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.4.161-5.6.0-devel+git.0f0011824921 #1
[ 1.088726] Hardware name: Freescale i.MX7 Dual (Device Tree)
[ 1.094495] [<8010eaf8>] (unwind_backtrace) from [<8010bb1c>] (show_stack+0x10/0x14)
[ 1.102248] [<8010bb1c>] (show_stack) from [<80914d84>] (dump_stack+0x90/0xa4)
[ 1.109480] [<80914d84>] (dump_stack) from [<8090c38c>] (__warn+0xbc/0xd8)
[ 1.116363] [<8090c38c>] (__warn) from [<8090c42c>] (warn_slowpath_fmt+0x84/0x98)
[ 1.123856] [<8090c42c>] (warn_slowpath_fmt) from [<8058b538>] (dev_pm_attach_wake_irq.constprop.0+0xd0/0xd4)
[ 1.133780] [<8058b538>] (dev_pm_attach_wake_irq.constprop.0) from [<8058b688>] (dev_pm_set_wake_irq+0x40/0x70)
[ 1.143879] [<8058b688>] (dev_pm_set_wake_irq) from [<8065d670>] (pcf85063_probe+0x204/0x2f4)
[ 1.152414] [<8065d670>] (pcf85063_probe) from [<8065ed90>] (i2c_device_probe+0xac/0x2c4)
[ 1.160601] [<8065ed90>] (i2c_device_probe) from [<8057e950>] (really_probe+0x24c/0x488)
[ 1.168701] [<8057e950>] (really_probe) from [<8057ed54>] (driver_probe_device+0x78/0x1c4)
[ 1.176974] [<8057ed54>] (driver_probe_device) from [<8057f100>] (device_driver_attach+0x58/0x60)
[ 1.185854] [<8057f100>] (device_driver_attach) from [<8057f1bc>] (__driver_attach+0xb4/0x154)
[ 1.194473] [<8057f1bc>] (__driver_attach) from [<8057cad8>] (bus_for_each_dev+0x64/0x90)
[ 1.202659] [<8057cad8>] (bus_for_each_dev) from [<8057db18>] (bus_add_driver+0x16c/0x208)
[ 1.210931] [<8057db18>] (bus_add_driver) from [<8057fa34>] (driver_register+0x74/0x108)
[ 1.219029] [<8057fa34>] (driver_register) from [<8065f68c>] (i2c_register_driver+0x3c/0xac)
[ 1.227474] [<8065f68c>] (i2c_register_driver) from [<80102670>] (do_one_initcall+0x44/0x194)
[ 1.236009] [<80102670>] (do_one_initcall) from [<80e00e64>] (kernel_init_freeable+0x148/0x1e4)
[ 1.244716] [<80e00e64>] (kernel_init_freeable) from [<80914f2c>] (kernel_init+0x8/0x110)
[ 1.252900] [<80914f2c>] (kernel_init) from [<801010e8>] (ret_from_fork+0x14/0x2c)
[ 1.260469] Exception stack(0xb0093fb0 to 0xb0093ff8)
[ 1.265525] 3fa0: 00000000 00000000 00000000 00000000
[ 1.273707] 3fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 1.281888] 3fe0: 00000000 00000000 00000000 00000000 00000013 00000000
[ 1.288511] ---[ end trace 2ff9b5ad99dcb9b6 ]---
[ 1.293186] rtc rtc0: failed to enable irq wake
[ 1.303787] rtc-pcf85063 3-0051: registered as rtc0
[ 1.309405] snvs_rtc 30370000.snvs:snvs-rtc-lp: registered as rtc1
[ 1.315738] i2c /dev entries driver
Then, when using the RTC device several times, everything looks good.
~$ echo +10 > /sys/class/rtc/rtc0/wakealarm
I can see, that changes to the alarm are reflected in the corresponding registers (it works as expected).
~$ i2cdump -f -y -r 0x0-0xf 3 0x51 b
0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
00: 00 00 00 00 40 36 15 28 01 11 22 40 36 15 28 80 ....#6?(??"#6?(?
I can repeat this commands as much as I like… …but when I enter the suspend mode, the behavior changes!
~$ echo +10 > /sys/class/rtc/rtc0/wakealarm
~$ systemctl suspend
After the 10s, the system resumes. But now, I am no more able to activate a new alarm:
~$ echo +10 > /sys/class/rtc/rtc0/wakealarm
-sh: echo: write error: Permission denied
And dumping i2c device looks very strange…
~$ i2cdump -f -y -r 0x0-0xf 3 0x51 b
0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
00: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX
…and the output of dmesg is as follows (there seems to be an exception with the RTC driver):
--- snip ---
[ 287.991068] OOM killer enabled.
[ 287.994212] Restarting tasks ...
[ 288.018896] usbmisc_imx 30b10200.usbmisc: vbus is error [ 288.027546] usbmisc_imx 30b10200.usbmisc: Error occurs during detection: -22 [ 288.040850] done.
[ 288.045136] PM: suspend exit
[ 288.188113] irq 66: nobody cared (try booting with the "irqpoll" option)
[ 288.194832] CPU: 0 PID: 1 Comm: systemd Tainted: G W O 5.4.161-5.6.0-devel+git.0f0011824921 #1
[ 288.204571] Hardware name: Freescale i.MX7 Dual (Device Tree) [ 288.210341] [<8010eaf8>] (unwind_backtrace) from [<8010bb1c>] (show_stack+0x10/0x14) [ 288.218092] [<8010bb1c>] (show_stack) from [<80914d84>] (dump_stack+0x90/0xa4) [ 288.225320] [<80914d84>] (dump_stack) from [<8090ca54>] (__report_bad_irq+0x3c/0xc0) [ 288.233071] [<8090ca54>] (__report_bad_irq) from [<8016ea20>] (note_interrupt+0x264/0x2b0) [ 288.241341] [<8016ea20>] (note_interrupt) from [<8016b728>] (handle_irq_event_percpu+0x58/0x64)
[ 288.250045] [<8016b728>] (handle_irq_event_percpu) from [<8016b778>] (handle_irq_event+0x44/0x68) [ 288.258921] [<8016b778>] (handle_irq_event) from [<8016f468>] (handle_level_irq+0xb4/0x140) [ 288.267278] [<8016f468>] (handle_level_irq) from [<8016a868>] (generic_handle_irq+0x24/0x34) [ 288.275723] [<8016a868>] (generic_handle_irq) from [<80518614>] (mxc_gpio_irq_handler+0x48/0x164) [ 288.284603] [<80518614>] (mxc_gpio_irq_handler) from [<80519214>] (mx3_gpio_irq_handler+0x60/0xac) [ 288.293567] [<80519214>] (mx3_gpio_irq_handler) from [<8016a868>] (generic_handle_irq+0x24/0x34) [ 288.302355] [<8016a868>] (generic_handle_irq) from [<8016ae6c>] (__handle_domain_irq+0x5c/0xb0) [ 288.311058] [<8016ae6c>] (__handle_domain_irq) from [<80506fbc>] (gic_handle_irq+0x4c/0x90) [ 288.319413] [<80506fbc>] (gic_handle_irq) from [<80101e10>] (__irq_usr+0x50/0x80) [ 288.326895] Exception stack(0xb0093fb0 to 0xb0093ff8)
[ 288.331950] 3fa0: 00832870 76f699cc 0000006f 0000006f
[ 288.340131] 3fc0: 00832848 008191c8 80000000 fffffffa 007ff6d8 007ff6d8 7ed5aa4c 76f699cc [ 288.348310] 3fe0: 76fb6d6c 7ed5a9f0 76f1b4ad 76ce70a0 600f0030 ffffffff [ 288.354922] handlers:
[ 288.357200] [<e0ffacc5>] irq_default_primary_handler threaded [<c40163d5>] pcf85063_rtc_handle_irq [ 288.366168] Disabling IRQ #66 [ 288.434623] systemd-journald[171]: Successfully sent stream file descriptor to service manager.
--- snip ---
Can anyone help me to get the external RTC running also after a suspend/resume change? Any help would be greatly appreciated.
Cheers
Update:
I am aware that both the internal (snvs_rtc) and external (PCF85063) RTCs are used. It would be enough to use only the external RTC, but I have not managed to disable it. When it is disabled, the system no longer boots and this last dmesg message appears:
[ OK ] Mounted /var/volatile.
Starting Load/Save Random Seed...
[ 6.396724] systemd-journald[173]: Successfully sent stream file descriptor to service manager.
[ OK ] Started udev Kernel Device Manager.
[ OK ] Started Load/Save Random Seed.
I have disabled it with following code in the DTS:
&snvs_rtc {
status = "disabled";
};
This part from dmesg you claim is good is actually not:
[ 1.071396] rtc-pcf85063 3-0051: wake irq already initialized
[ 1.293186] rtc rtc0: failed to enable irq wake
Which is the warning splat you get in the full dmesg.
Are you sure about the RTC interrupt being connected on gpio1 1? It seems this GPIO is already used as a wakeup interrupt by another driver.
Note that the wakeup-source; property is not needed when you have an interrupt defined.

Find the interface type and revision of a hard drive using in a windows machine

I'm looking for a command in Windows (either cmd or powershell) which will allow me to get which exact type of bus interface my storage device have, not only the type, but also the revision (SATA3, SATA4, NVME2.0 and so on).
For example:
> wmic diskdrive get InterfaceRevision
InterfaceRevision
SATA3
SATA4
NVME2.0
This will get you the bus but not the version.
Function Get-MaxLength {
<#
.SYNOPSIS
Finds the length of the longest item in collection.
.DESCRIPTION
Use this Function to get the length of the longest item in a
collection for use in format strings or other places where
needed.
.PARAMETER TestObj
The qualified object to be tested. See example!
.Parameter MinLen
The minimum length of the item (if using for formatting) which
should be the Label (title) length. Note if the object item
being tested does not have a Length property you MUST specify
the label length!
.OUTPUTS
Returns a numerical value
.EXAMPLE
$NameLen = Get-MaxLength -TestObj $DotNet.PSChildName
$VerLen = Get-MaxLength -TestObj $DotNet.Version
$RNLen = Get-MaxLength -TestObj $DotNet.Release -MinLen 11
#--- .Net Information ---
$fmtDotNet =
#{Expression={$_.PSChildName};Label=".Net Type";Width=$NameLen},
#{Expression={$_.Version};Label="Version No:";Width=$VerLen},
#{Expression={$_.Release};Label="Release No:";Width=$RNLen}
$Dotnet | Format-Table $fmtDotNet
#>
Param(
[Parameter(Mandatory=$True)]
[object] $TestObj,
[Parameter(Mandatory=$False)]
[int] $MinLen = 0,
[Parameter(Mandatory=$False)]
[int] $MaxLen = 0
)
$ErrorActionPreference = "SilentlyContinue"
foreach ($x in $TestObj) {
If ($x.Trim().length -gt $MinLen) {
$MinLen = $x.Trim().length
}
}
If ($MaxLen -ne 0) {
If ($MinLen -gt $MaxLen) {
$MinLen = $MaxLen
}
}
$ErrorActionPreference = "Continue"
Return ,$MinLen
} #End Function ----------- Get-MaxLength -------------------
Function PhysicalDiskTab {
#Physical Drive Info
$PhyDiskInfo = Get-Disk | Where-Object {$_.size -gt 0 } |
Sort-Object -Property DiskNumber
$SSD = $False
$AMArgs = #{Type = 'NoteProperty'
Name = 'SSD'
Value = 'No'}
$PhyDiskInfo | Add-Member #AMArgs
$AMArgs = #{Type = 'NoteProperty'
Name = 'Speed'
Value = '0'}
$PhyDiskInfo | Add-Member #AMArgs
$GCIArgs = #{
NameSpace = "root\Microsoft\Windows\Storage"
Class = "MSFT_PhysicalDisk"
ErrorAction = "SilentlyContinue"
}
$RotateSpeed = Get-CimInstance #GCIArgs |
Select-Object -Property DeviceID,#{Name="Speed/RPMs";
Expression={(&{If($_.MediaType -eq 0) {[Int]0}
Else {$_.SpindleSpeed/600000 -f "#,###"}})}} |
Sort-Object DeviceID
ForEach ($x in $phydiskinfo) {
ForEach ($Device in $RotateSpeed) {
If ($x.number -eq $Device.DeviceID) {
If ($Device.'Speed/RPMs' -eq 0) {
$SSD = $True
$x.SSD = "Yes"
} #End If
Else {
$x.Speed = $([Int]$Device.'SPeed/RPMs') -f "#,###"
}
} #End If ($x.number...
} #End ForEach ($Device
} #End ForEach $x
$DNLen =
Get-MaxLength -TestObj $PhyDiskInfo.Model -MinLen 4
$SNLen =
Get-MaxLength -TestObj $PhyDiskInfo.SerialNumber -MinLen 13
$fmtPhyDisk1 =
#{Expression={ '{0:N0}' -f $_.Number};
Label="Drive`n No.";Width=5;Align='Center'},
#{Expression={$_.Model};Label="`nName";Width=$DNLen},
#{Expression={$_.SSD};Label="`nSSD";Width=3;Align='left'},
#{Expression={ '{0:#,000.00}' -f ($_.Size/1gb)};
Label="Disk Size`n / GB";Width=9;align='right'},
#{Expression={$_.NumberOfPartitions};
Label="Parti`ntions";Width=5},
#{Expression={$_.PartitionStyle};Label="GPT`nMBR";Width=3},
#{Expression={(&{If ($_.IsBoot) {"Yes"} else {""}})};
Label="`nBoot";Width=5;Align="Left"},
#{Expression={(&{If ($_.BusType.GetType().Name -eq 'UInt16'){
(& {Switch ($_.BusType) {
0 {"Unknown"}
1 {"SCSI"}
2 {"ATAPI"}
3 {"ATA"}
4 {"1394"}
5 {"SSA"}
6 {"Fibre Channel"}
7 {"USB"}
8 {"RAID"}
9 {"iSCSI"}
10 {"SAS"}
11 {"SATA"}
12 {"SD"}
13 {"MMC"}
14 {"MAX"}
15 {"File Backed Virtual"}
16 {"Storage Spaces"}
17 {"NVMe"}
18 {"MS Reserved"}
Default {"Unknown"}}})}
Else{$_.BusType}})};Label="`nData Bus";Width=20}
$fmtPhyDisk2 =
#{Expression={ '{0:N0}' -f $_.Number};
Label="Drive`n No.";Width=5;Align='Center'},
#{Expression={$_.Model};Label="`nName";Width=$DNLen},
#{Expression={$_.SerialNumber.Trim()};
Label="`nSerial Number";Width=$SNLen;Align='left'},
#{Expression={
(&{If ($_.HealthStatus.GetType().Name -eq 'UInt16'){
(& {Switch ($_.HealthStatus) {
0 {"Healthy"}
1 {"Warning"}
2 {"Unhealthy"}
Default {"Unknown"}}})}
Else{$_.HealthStatus}})};Label="`nStatus";Width=7},
#{Expression={$_.Speed};
Label="Rotation`n RPMs ";Width=8;Align='Right'}
$PhyDiskInfo1 = $PhyDiskInfo |
Format-Table -Property $fmtPhyDisk1 -Wrap |
Out-String -Width $OStrWidth
$PhyDiskInfo2 = $PhyDiskInfo |
Format-Table -Property $fmtPhyDisk2 -Wrap |
Out-String -Width $OStrWidth
$PhyDiskTitle = "Physical Disk Information:" | Out-String
Return ,$($PhyDiskTitle + $PhyDiskInfo1 + $PhyDiskInfo2)
} #End Function ---------------- PhysicalDiskTab --------------
$OStrWidth = 79
PhysicalDiskTab
Output:
Physical Disk Information:
Drive Disk Size Parti GPT
No. Name SSD / GB tions MBR Boot Data Bus
----- ----- --- --------- ----- --- ----- ---------
0 Samsung SSD 960 Yes 232.89 4 GPT Yes NVMe
1 Samsung SSD 850 PRO 256GB Yes 238.47 2 GPT SATA
2 Samsung SSD 850 PRO 256GB Yes 238.47 1 GPT SATA
Drive Rotation
No. Name Serial Number Status RPMs
----- ----- -------------- ------- --------
0 Samsung SSD 960 0025_3853_81B0_B2EB. Healthy 0
1 Samsung SSD 850 PRO 256GB S39KNX0J687882W Healthy 0
2 Samsung SSD 850 PRO 256GB S39KNX0J688151N Healthy 0
This code was pulled from my CMsLocalPCInfoW10 program which can be downloaded from my shared OneDrive library.

Spansion S25HS512T NOR Flash not working on linux or u-boot

I have a custom board (NXP iMX6UL) with Spansion Flash 25HS512TFANHI010 which I cant seem to get working.
My dtsi has the following
...
pinctrl_qspi: qspigrp {
fsl,pins = <
MX6UL_PAD_NAND_WP_B__QSPI_A_SCLK 0x70a1
MX6UL_PAD_NAND_READY_B__QSPI_A_DATA00 0x70a1
MX6UL_PAD_NAND_CE0_B__QSPI_A_DATA01 0x70a1
MX6UL_PAD_NAND_CE1_B__QSPI_A_DATA02 0x70a1
MX6UL_PAD_NAND_CLE__QSPI_A_DATA03 0x70a1
MX6UL_PAD_NAND_DQS__QSPI_A_SS0_B 0x70a1
>;
};
...
&qspi {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_qspi>;
status = "okay";
//cs-gpios = <&gpio4 16 0>;
flash0: s25hs512t#0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "spansion,s25hs512t", "jedec,spi-nor";
spi-max-frequency = <40000000>;
spi-rx-bus-width = <4>;
spi-tx-bus-width = <4>;
reg = <0>;
spi-mode = <0>;
spi-cpha;
spi-cpol;
m25p,fast-read;
//wp-gpios = <&gpio4 14 0>;
//hold-gpios = <&gpio4 15 0>;
status = "okay";
};
};
For u-boot my defconfig has the following
CONFIG_DM=y
CONFIG_SPI=y
CONFIG_SPI_FLASH=y
CONFIG_SPI_FLASH_SPANSION=y
CONFIG_DM_SPI=y
CONFIG_DM_SPI_FLASH=y
CONFIG_FSL_QSPI=y
CONFIG_SF_DEFAULT_MODE=0
for linux my defconfig has basically (among a lot of other stuff)
CONFIG_SPI_FSL_QUADSPI=y
so both u-boot and Linux doesn't seem to work well
u-boot Error
U-Boot 2021.10-rc2-00044-g4865db0716-dirty (Aug 24 2021 - 23:15:49 +0530)
...
=> sf probe
fsl_qspi spi#21e0000: spi_find_chip_select: plat=9ef61e10, cs=0
fsl_qspi spi#21e0000: spi_find_chip_select: plat=9ef61e10, cs=0
jedec_spi_nor s25hs512t#0: set_state_simple op missing
fsl_qspi spi#21e0000: CMD[9f] lutval[0:1c00049f 1:0 2:0 3:0]
Failed to initialize SPI flash at 0:0 (error -524)
DM Tree
=> dm tree
Class Index Probed Driver Name
-----------------------------------------------------------
root 0 [ + ] root_driver root_driver
thermal 0 [ ] imx_thermal |-- imx_thermal
simple_bus 0 [ + ] simple_bus |-- soc
simple_bus 1 [ + ] simple_bus | |-- aips-bus#2000000
simple_bus 2 [ ] simple_bus | | |-- spba-bus#2000000
gpio 0 [ ] gpio_mxc | | |-- gpio#209c000
gpio 1 [ ] gpio_mxc | | |-- gpio#20a0000
gpio 2 [ ] gpio_mxc | | |-- gpio#20a4000
gpio 3 [ ] gpio_mxc | | |-- gpio#20a8000
gpio 4 [ ] gpio_mxc | | |-- gpio#20ac000
simple_bus 3 [ ] simple_bus | | |-- anatop#20c8000
simple_bus 4 [ ] simple_bus | | |-- snvs#20cc000
pinctrl 0 [ + ] fsl_imx6q_iomuxc | | `-- iomuxc#20e0000
pinconfig 0 [ ] pinconfig | | |-- i2c1grp
pinconfig 1 [ ] pinconfig | | |-- i2c2grp
pinconfig 2 [ + ] pinconfig | | |-- qspigrp
pinconfig 3 [ ] pinconfig | | |-- tscgrp
pinconfig 4 [ ] pinconfig | | |-- uart1grp
pinconfig 5 [ + ] pinconfig | | |-- usdhc2grp
pinconfig 6 [ ] pinconfig | | `-- wdoggrp
simple_bus 5 [ + ] simple_bus | `-- aips-bus#2100000
mmc 0 [ + ] fsl_esdhc | |-- usdhc#2194000
blk 0 [ ] mmc_blk | | `-- usdhc#2194000.blk
i2c 0 [ ] i2c_mxc | |-- i2c#21a0000
i2c 1 [ ] i2c_mxc | |-- i2c#21a4000
spi 0 [ + ] fsl_qspi | `-- spi#21e0000
spi_flash 0 [ ] jedec_spi_nor | `-- s25hs512t#0
regulator 0 [ ] regulator_fixed `-- regulator-sd2-vmmc
Linux Error
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 5.14.0-rc7-413454-gd5ae8d7f85b7 (harkirat#harkirat-devsys) (arm-linux-gnueabihf-gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #3 SMP Tue Aug 24 22:47:19 IST 2021
[ 0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c5387d
...
[ 2.639396] spi spi0.0: setup: unsupported mode bits 3
[ 2.645215] fsl-quadspi 21e0000.spi: can't setup spi0.0, status -22
[ 2.651590] spi_master spi0: spi_device register error /soc/bus#2100000/spi#21e0000/s25hs512t#0
[ 2.660817] spi_master spi0: Failed to create SPI device for /soc/bus#2100000/spi#21e0000/s25hs512t#0
...
I have tried almost every iteration possible, but I can seem to get to the issue. I have a feeling its something to do with the dtsi. Any help will be appreciated, am at wits end.
PS: tried the cypress forums but they have been very non responsive. they have a u-boot patch from 2018.01 which is as such not compatible with 2021.10
Support for S25HL/S25HS series has been added in u-boot 2021.10-rc3.
Ensure:
CONFIG_SPI_FLASH_SFDP_SUPPORT is set and
CONFIG_SPI_FLASH_BAR is not set
Thanks to Mr. Kuwano of Infineon for the support.
PS:
Not tested on Linux. Not working on Barebox yet (getting detected but not writing).

Keep files one daily, one 3 days and one week and delete others

I have a folder containing database backup files for the last 15 days.
I need to delete all files and keep only one daily, one 3 days and one week.
Can someone help on this ?
I tried some scripts but none met my requirements
mkdir -p monthly
mkdir -p weekly
ln backup_$NOW.tgz weekly/
# find current month
month=$(date +%Y-%m-)
# find the first file of the current month in the weekly folder
first_monthly=$(ls --sort=time -1 weekly/*$month* 2>/dev/null | tail -1)
# and put it in the monthly folder
ln -f $first_monthly monthly/
# we need only 5 weekly backups
ls --sort=time -1 weekly/* 2>/dev/null | tail -n+6 >> /tmp/deletebackups.txt
# we need only 5 monthly backups
ls --sort=time -1 monthly/* 2>/dev/null | tail -n+6 >> /tmp/deletebackups.txt
# delete the extra files
#rm $(cat /tmp/deletebackups.txt) 2>/dev/null
xargs --arg-file /tmp/deletebackups.txt rm
here's one way to determine what to keep or delete. it uses an array of "age in days to keep" and then checks to see if the file age is in that collection.
$DaysOldToKeep = #(
0
3
7
)
$SourceDir = $env:TEMP
$Today = (Get-Date).Date
$FileList = Get-ChildItem -LiteralPath $SourceDir -File |
Sort-Object -Property CreationTime
foreach ($FL_Item in $FileList)
{
$DaysOld = ($Today - $FL_Item.CreationTime).Days
if ($DaysOld -notin $DaysOldToKeep)
{
Write-Warning ('[ {0} ] is [ {1} ] days old & should be removed.' -f $FL_Item.Name, $DaysOld)
}
else
{
Write-Host (' [ {0} ] is [ {1} ] days old & should be KEPT.' -f $FL_Item.Name, $DaysOld)
}
}
truncated output ...
WARNING: [ testing-making-dir-and-file.txt ] is [ 9 ] days old & should be removed.
WARNING: [ hd4B753.tmp ] is [ 8 ] days old & should be removed.
[ Itunes_AlbumAutoRating_Disable.ps1_2019-04-08.log ] is [ 7 ] days old & should be KEPT.
[ vscode-inno-updater-1554768842.log ] is [ 7 ] days old & should be KEPT.
[ hd464FA.tmp ] is [ 7 ] days old & should be KEPT.
[ hd4E2F0.tmp ] is [ 7 ] days old & should be KEPT.
WARNING: [ Genre-List_2019-04-09.log ] is [ 6 ] days old & should be removed.
WARNING: [ Grouping-Strings-List_2019-04-10.log ] is [ 5 ] days old & should be removed.
WARNING: [ Itunes_R-PC-SC_Save.ps1_2019-04-11.log ] is [ 4 ] days old & should be removed.
[ Magenoob_-_Merged_User_Info.csv ] is [ 3 ] days old & should be KEPT.
[ Itunes_Default-Rating_Set.ps1_2019-04-12.log ] is [ 3 ] days old & should be KEPT.
[ MagicTheGathering_-_Scryfall-Default-Cards.json ] is [ 3 ] days old & should be KEPT.
WARNING: [ hd4C490.tmp ] is [ 2 ] days old & should be removed.
WARNING: [ hd45A92.tmp ] is [ 1 ] days old & should be removed.
[ exthost-825471.cpuprofile ] is [ 0 ] days old & should be KEPT.
[ vscode-inno-updater-1555314279.log ] is [ 0 ] days old & should be KEPT.
[ npp.7.6.6.Installer.x64.exe ] is [ 0 ] days old & should be KEPT.
[ hd43E2A.tmp ] is [ 0 ] days old & should be KEPT.
[ hd44D37.tmp ] is [ 0 ] days old & should be KEPT.
[ hd4488C.tmp ] is [ 0 ] days old & should be KEPT.
[ hd45A09.tmp ] is [ 0 ] days old & should be KEPT.
[ Itunes_AlbumAutoRating_Disable.ps1_2019-04-15.log ] is [ 0 ] days old & should be KEPT.
A way to retrieve the first newest files would be :
ls -t weekly/ | head -1
And to have the rest of the oldest, to delete :
ls -t weekly/ | tail +2
If you want to keep it bash only, it may be the simplest way.
try something like this (remove -whatif if you want really remove):
$File1Founded=$false
$File3Founded=$false
$File7Founded=$false
$CurrentDate1=(get-date).Date
$CurrentDate3=(get-date).AddDays(-3).Date
$CurrentDate7=(get-date).AddDays(-7).Date
Get-ChildItem "C:\temp\test1" -file | sort CreationTime -Descending | %{
$DateFile=$_.CreationTime.Date
if ($DateFile -eq $CurrentDate1)
{
if ($File1Founded)
{
$_
}
else
{
$File1Founded=$true
}
}
elseif ($DateFile -eq $CurrentDate3)
{
if ($File3Founded)
{
$_
}
else
{
$File3Founded=$true
}
}
elseif ($DateFile -eq $CurrentDate7)
{
if ($File7Founded)
{
$_
}
else
{
$File7Founded=$true
}
}
else
{
$_
}
} | Remove-Item -WhatIf

Bash: update variable that uses a updated variable

I am trying to get a little Backupscript running and I'm kinda stuck with something maybe so easy, but I cannot get it to work.
I use echo "backup 1 started" / echo "backup 1 ended" after each part of the backup (each called with individual scripts.) That's been running fine, but I want to use more variables so its easier to edit afterwards.
Here is my testscript
#!/bin/bash
# Backupcountervariable
bc=1
# Startbackup
startecho="echo $(date +%F_%T) | dobackup.sh | Backup "$bc" started!"
# Endbackup
endecho="echo $(date +%F_%T) | dobackup.sh | Backup "$bc" ended!"
echo $bc
$startecho
$endecho
bc=$(($bc+1))
echo $bc
$startecho
$endecho
The variable bc gets updated in between, that I know for sure. I think my problem is that one $startecho and $endecho are initiated they don't update $bc.
Any hints how I update a variable inside a variable?
EDIT:
Sorry for misleading you guys on what iam doing here. Here you can see the full backup script. It only calls the individual backupscripts and puts the output to the logfile.
So iam just executing this script via cron, instead of 5 scripts.
#!/bin/bash
# Backupscripte ausfuehren 0.5
# Created: 2013/05/30 22:00
# Updated: 2013/06/05 02:31
# 0.5: Log verbessert, teamspeak hinzugefuegt, backupcounter
# 0.6: funktionen eingebaut, uebersichtlichkeit verbessert
### Variablendeklaration
# Log Variable definieren
logfile="/var/log/dobackup.log"
# Backupcountervariable
bc=1
# Backupcounterincrement
function bci() { bc=$((bc+1)) ; }
# Startbackup
function startecho() { echo "$(date +%F_%T) | dobackup.sh | Backup $bc gestartet!" >>$logfile ; }
# Endbackup
function endecho() { echo "$(date +%F_%T) | dobackup.sh | Backup $bc beendet!" >>$logfile ; }
# Start des Backups Ausgeben
echo "----------------------------------------------------------------" >>$logfile
echo "$(date +%F_%T) | dobackup.sh | FULL BACKUP GESTARTET!" >>$logfile
#### /var/www Backup
# Start Backup ausgeben
startecho
# Backupscript ausfuehren
sh /root/varwwwbackup.sh >>$logfile
# Ende Backup ausgeben
endecho
# Increment Backupcounter
bci
#### /var/customers Backup
# Start Backup ausgeben
startecho
# Backupscript ausfuehren
sh /root/customersbackup.sh >>$logfile
# Ende Backup ausgeben
endecho
# Increment Backupcounter
bci
#### Mysqldump Backup
# Start Backup ausgeben
startecho
# Backupscript ausfuehren
sh /root/mysqlbackup.sh >>$logfile
# Ende Backup ausgeben
endecho
# Increment Backupcounter
bci
### TS3 Backup
# Start Backup ausgeben
startecho
# Backupscript ausfuehren
sh /root/tsbackup.sh >>$logfile
# Ende Backup ausgeben
endecho
# Increment Backupcounter
bci
# Cleanup Backup FTP, remove files older then 30 days
echo "$(date +%F_%T) | dobackup.sh | Cleanup fuer den Backup FTP Server begonnen..." >>$logfile
#sh /root/cleanbackup.sh >>$logfile
echo "$(date +%F_%T) | dobackup.sh | Cleanup fuer den Backup FTP Server abgeschlossen!" >>$logfile
# Ende des Backups Ausgeben
echo "$(date +%F_%T) | dobackup.sh | FULL BACKUP BEENDET!" >>$logfile
So my log looks like this:
----------------------------------------------------------------
2013-06-05_04:00:01 | dobackup.sh | FULL BACKUP GESTARTET!
2013-06-05_04:00:01 | dobackup.sh | Backup 1 gestartet!
2013-06-05_04:00:01 | Backupscript fuer /var/www/ gestartet!
2013-06-05_04:00:01 | Verzeichnis gewechselt! Beginne damit das Verzeichnis einzupacken...
2013-06-05_04:00:01 | Verzeichnis eingepackt! Beginne damit das Verzeichnis auf den FTP Server zu kopieren...
2013-06-05_04:00:01 | Backup erfolgreich auf den FTP Server verschoben! Temporaere Dateien werden nun geloescht...
2013-06-05_04:00:01 | Temporaere Dateien geloescht!
2013-06-05_04:00:01 | Backupscript fuer /var/www/ abgeschlossen!
2013-06-05_04:00:01 | dobackup.sh | Backup 1 beendet!
2013-06-05_04:00:01 | dobackup.sh | Backup 2 gestartet!
2013-06-05_04:00:01 | Backupscript fuer /var/customers/ gestartet!
2013-06-05_04:00:01 | Verzeichnis gewechselt! Beginne damit das Verzeichnis einzupacken...
2013-06-05_04:01:16 | Verzeichnis eingepackt! Beginne damit das Verzeichnis auf den FTP Server zu kopieren...
2013-06-05_04:04:56 | Backup erfolgreich auf den FTP Server verschoben! Temporaere Dateien werden nun geloescht...
2013-06-05_04:04:56 | Temporaere Dateien geloescht!
2013-06-05_04:04:56 | Backupscript fuer /var/customers/ abgeschlossen!
2013-06-05_04:04:56 | dobackup.sh | Backup 2 beendet!
2013-06-05_04:04:56 | dobackup.sh | Backup 3 gestartet!
2013-06-05_04:04:56 | Backupscript fuer mysqldump gestartet!
2013-06-05_04:04:56 | Verzeichnis gewechselt! Beginne mit dem mysqldump...
2013-06-05_04:04:56 | Mysqldump ausgefuehrt! Beginne mit dem einpacken des mysqldumps...
2013-06-05_04:04:56 | SQL Backup eingepackt! Beginne damit das Backup auf den FTP Server zu kopieren...
2013-06-05_04:04:56 | Backup auf FTP Server veschoben! Temporaere Files werden entfernt...
2013-06-05_04:04:56 | Temporaere Files wurden entfernt!
2013-06-05_04:04:56 | Backupscript fuer mysqldump abgeschlossen!
2013-06-05_04:04:56 | dobackup.sh | Backup 3 beendet!
2013-06-05_04:04:56 | dobackup.sh | Backup 4 gestartet!
2013-06-05_04:04:56 | Backupscript fuer /home/ts3/ gestartet!
2013-06-05_04:04:56 | Verzeichnis gewechselt! Beginne damit das Verzeichnis einzupacken...
2013-06-05_04:08:47 | Verzeichnis eingepackt! Beginne damit das Verzeichnis auf den FTP Server zu kopieren...
2013-06-05_04:17:08 | Backup erfolgreich auf den FTP Server verschoben! Temporaere Dateien werden nun geloescht...
2013-06-05_04:17:08 | Temporaere Dateien geloescht!
2013-06-05_04:17:08 | Backupscript fuer /home/ts3/ abgeschlossen!
2013-06-05_04:17:08 | dobackup.sh | Backup 4 beendet!
2013-06-05_04:17:08 | dobackup.sh | Cleanup fuer den Backup FTP Server begonnen...
2013-06-05_04:17:08 | dobackup.sh | Cleanup fuer den Backup FTP Server abgeschlossen!
2013-06-05_04:17:08 | dobackup.sh | FULL BACKUP BEENDET!
as of now only the dobackup.sh does the "| dobackup.sh |" output...
Greetings
David
Instead of a string, you should use a shell function:
function startecho() { date +%F_%T ; echo " dobackup.sh | Backup $bc started!" ; }
function endecho() { date +%F_%T ; echo " dobackup.sh | Backup $bc ended!" ; }
startecho
endecho
bc=$((bc+1))
startecho
endecho
This won't necessarily work:
startecho="echo $(date +%F_%T) | dobackup.sh | Backup "$bc" started!"
You need to put $(..) around the entire echo statement:
startecho="$(echo "$(date +%F_%T) | dobackup.sh | Backup "$bc" started!")"

Resources