Why does EnumDisplayDevices return so many results? - c

I have a Windows computer with an Nvidia card and an Intel card. Each GPU has one screen connected to it.
Then I use the following code to list all the display devices:
DISPLAY_DEVICE lDevice;
lDevice.cb = sizeof(DISPLAY_DEVICE);
int i = 0;
while (EnumDisplayDevices(NULL, i, &lDevice, EDD_GET_DEVICE_INTERFACE_NAME) != 0) {
printf(
"i: %d\n"
"cb: %d\n"
"DeviceName: %s\n"
"DeviceString: %s\n"
"StateFlags: %d\n"
"DeviceID: %s\n"
"DeviceKey: %s\n",
i,
lDevice.cb,
lDevice.DeviceName,
lDevice.DeviceString,
lDevice.StateFlags,
lDevice.DeviceID,
lDevice.DeviceKey
);
i++;
}
This is the output:
i: 0
cb: 424
DeviceName: \\.\DISPLAY1
DeviceString: Intel(R) HD Graphics 4600
StateFlags: 134217729
DeviceID:
DeviceKey: \Registry\Machine\System\CurrentControlSet\Control\Video\{3C36D58A-5C95-11EB-ACEC-B083FE9A7909}\0000
i: 1
cb: 424
DeviceName: \\.\DISPLAY2
DeviceString: Intel(R) HD Graphics 4600
StateFlags: 0
DeviceID:
DeviceKey: \Registry\Machine\System\CurrentControlSet\Control\Video\{3C36D58A-5C95-11EB-ACEC-B083FE9A7909}\0001
i: 2
cb: 424
DeviceName: \\.\DISPLAY3
DeviceString: NVIDIA GeForce GTX 1060 3GB
StateFlags: 5
DeviceID:
DeviceKey: \Registry\Machine\System\CurrentControlSet\Control\Video\{46FC15D3-C98C-11E9-ACCA-D1E7BCEC4649}\0000
i: 3
cb: 424
DeviceName: \\.\DISPLAY4
DeviceString: NVIDIA GeForce GTX 1060 3GB
StateFlags: 0
DeviceID:
DeviceKey: \Registry\Machine\System\CurrentControlSet\Control\Video\{46FC15D3-C98C-11E9-ACCA-D1E7BCEC4649}\0001
i: 4
cb: 424
DeviceName: \\.\DISPLAY5
DeviceString: NVIDIA GeForce GTX 1060 3GB
StateFlags: 0
DeviceID:
DeviceKey: \Registry\Machine\System\CurrentControlSet\Control\Video\{46FC15D3-C98C-11E9-ACCA-D1E7BCEC4649}\0002
i: 5
cb: 424
DeviceName: \\.\DISPLAY6
DeviceString: NVIDIA GeForce GTX 1060 3GB
StateFlags: 0
DeviceID:
DeviceKey: \Registry\Machine\System\CurrentControlSet\Control\Video\{46FC15D3-C98C-11E9-ACCA-D1E7BCEC4649}\0003
I don't understand why there are 6 display devices, 2 for the Intel card and 4 for the Nvidia card. I think I'm probably missunderstanding the concept of display devices.
Here's the full code: https://gist.github.com/tuket/0cc2f9b77a4a6a82a72655941547e292

using StateFlags & DISPLAY_DEVICE_ATTACHED_TO_DESKTOP did seem to work for me.
demo https://github.com/rdp/enumdisplaydevices_console_app

Related

How to take the price from this Json object?

I tried to get the price value from this json object but no chance ,
can someone help me , thanks
{
"Id":10069,
"UrlHash":"3963aa68aac23b61ffc1275ad6e0f43d",
"BrandId":1,
"Name":"Nokia 8.3 5G",
"Picture":"https://fdn2.gsmarena.com/vv/bigpic/nokia-83-5g.jpg",
"ReleasedAt":"Released 2020, September 15",
"Body":"220g, 9mm thickness",
"Os":"Android 10, up to Android 11, Android One",
"Storage":"64GB/128GB storage, microSDXC",
"DisplaySize":"6.81\\\"",
"DisplayResolution":"1080x2400 pixels",
"CameraPixels":"64 MP ",
"VideoPixels":"2160p",
"Ram":"6/8 GB RAM ",
"Chipset":"Snapdragon 765G 5G",
"BatterySize":"4500 mAh ",
"BatteryType":"Li-Po",
"Specifications":"{\\\"Technology\\\":\\\"GSM \\\\/ HSPA \\\\/ LTE \\\\/ 5G\\\",\\\"2G bands\\\":\\\"GSM 850 \\\\/ 900 \\\\/ 1800 \\\\/ 1900 - SIM 1 & SIM 2\\\",\\\"3G bands\\\":\\\"HSDPA 850 \\\\/ 900 \\\\/ 1700(AWS) \\\\/ 1900 \\\\/ 2100 \\\",\\\"4G bands\\\":\\\"1, 2, 3, 4, 5, 7, 8, 12, 13, 17, 20, 28, 32, 38, 39, 40, 41, 66, 71\\\",\\\"5G bands\\\":\\\"1, 2, 3, 5, 7, 8, 28, 38, 40, 41, 66, 71, 78 SA\\\\/NSA\\\",\\\"Speed\\\":\\\"HSPA 42.2\\\\/5.76 Mbps, LTE-A (4CA) Cat18 1200\\\\/150 Mbps, 5G 2.4\\\\/1.2 Gbps\\\",\\\"Announced\\\":\\\"2020, March 19\\\",\\\"Status\\\":\\\"Available. Released 2020, September 15\\\",\\\"Dimensions\\\":\\\"171.9 x 78.6 x 9 mm (6.77 x 3.09 x 0.35 in)\\\",\\\"Weight\\\":\\\"220 g (7.76 oz)\\\",\\\"SIM\\\":\\\"Single SIM (Nano-SIM) or Hybrid Dual SIM (Nano-SIM, dual stand-by)\\\",\\\"Type\\\":\\\"Li-Po 4500 mAh, non-removable\\\",\\\"Size\\\":\\\"6.81 inches, 112.0 cm2 (~82.9% screen-to-body ratio)\\\",\\\"Resolution\\\":\\\"1080 x 2400 pixels, 20:9 ratio (~386 ppi density)\\\",\\\"OS\\\":\\\"Android 10, upgradable to Android 11, Android One\\\",\\\"Chipset\\\":\\\"Qualcomm SM7250 Snapdragon 765G 5G (7 nm)\\\",\\\"CPU\\\":\\\"Octa-core (1x2.4 GHz Kryo 475 Prime & 1x2.2 GHz Kryo 475 Gold & 6x1.8 GHz Kryo 475 Silver)\\\",\\\"GPU\\\":\\\"Adreno 620\\\",\\\"Card slot\\\":\\\"microSDXC (uses shared SIM slot)\\\",\\\"Internal\\\":\\\"64GB 6GB RAM, 64GB 8GB RAM, 128GB 8GB RAM\\\",\\\"Quad\\\":\\\"64 MP, f\\\\/1.9, (wide), 1\\\\/1.72\\\\\\\", 0.8\\\\u00b5m, PDAF\\\\r\\\\n 12 MP, f\\\\/2.2, 120\\\\u02da (ultrawide), 1\\\\/2.43\\\\\\\", 1.4\\\\u00b5m, AF\\\\r\\\\n 2 MP, (macro)\\\\r\\\\n 2 MP, (depth)\\\",\\\"Features\\\":\\\"Zeiss optics, HDR\\\",\\\"Video\\\":\\\"1080p#30fps\\\",\\\"Single\\\":\\\"24 MP, f\\\\/2.0, (wide), 1\\\\/2.8\\\\\\\", 0.9\\\\u00b5m\\\",\\\"Loudspeaker \\\":\\\"Yes\\\",\\\"3.5mm jack \\\":\\\"Yes\\\",\\\"WLAN\\\":\\\"Wi-Fi 802.11 a\\\\/b\\\\/g\\\\/n\\\\/ac, dual-band, Wi-Fi Direct, hotspot\\\",\\\"Bluetooth\\\":\\\"5.0, A2DP, EDR, LE\\\",\\\"GPS\\\":\\\"Yes, with A-GPS, GLONASS, BDS\\\",\\\"NFC\\\":\\\"Yes\\\",\\\"Radio\\\":\\\"FM radio\\\",\\\"USB\\\":\\\"USB Type-C 2.0, USB On-The-Go\\\",\\\"Sensors\\\":\\\"Fingerprint (side-mounted), accelerometer, gyro, proximity, compass\\\",\\\"Charging\\\":\\\"Fast charging 18W\\\",\\\"Colors\\\":\\\"Polar Night\\\",\\\"Models\\\":\\\"TA-1243, TA-1251\\\",\\\"SAR\\\":\\\"0.96 W\\\\/kg (head) 1.41 W\\\\/kg (body) \\\",\\\"SAR EU\\\":\\\"0.96 W\\\\/kg (head) 1.41 W\\\\/kg (body) \\\",\\\"Price\\\":\\\"$ 433.90 \\\\/ € 574.35 \\\\/ £ 349.00\\\"}",
"DeletedAt":null,
"CreatedAt":"2021-09-10T00:45:32",
}
PRICE property is inside Specification
\"Price\":\"$ 433.90 \\/ € 574.35 \\/ £ 349.00\"
The property Specifications has been corrupted. Someone has tried to escape the character for inches ", found in the Quad and Single properties, but they have escaped every single " in the JSON string! This needs to be fixed at the source.
Here's the Quad property found in Specifications
\\\"Quad\\\":\\\"64 MP, f\\\\/1.9, (wide), 1\\\\/1.72\\\\\\\", 0.8\\\\u00b5m, PDAF\\\\r\\\\n 12 MP, f\\\\/2.2, 120\\\\u02da (ultrawide), 1\\\\/2.43\\\\\\\", 1.4\\\\u00b5m, AF\\\\r\\\\n 2 MP, (macro)\\\\r\\\\n 2 MP, (depth)\\\"
and here's what it should be:
"Quad":"64 MP, f/1.9, (wide), 1/1.72\\\", 0.8u00b5m, PDAFrn 12 MP, f/2.2, 120u02da (ultrawide), 1/2.43\\\", 1.4u00b5m, AFrn 2 MP, (macro)rn 2 MP, (depth)"
Also, the Specifications value should not be surrounded in quotations.
"Specifications": {"Technology": "GSM / HSPA / LTE / 5G", ... },
I get the feeling someone is manually creating JSON strings instead of using a library. This a great example why you should never do that.
You just need to parse the JSON:
try {
const myObject: any = JSON.parse(YOUR_JSON_STRING_HERE);
const price = myObject.Specifications.Price;
console.log("Price:", price);
} catch (error) {
console.log(error);
}
if it's an array:
const price = myObjects[0].Specifications.Price;

Using Orbbec Embedded S camera from ARM with OpenNI

I have an ARM SoC that I've connected an Embedded S camera to. I can see the camera is connected:
$ lsusb
Bus 001 Device 006: ID 2bc5:050b
Bus 001 Device 007: ID 2bc5:060b
I downloaded OpenNI_2.3.0.63.zip from https://orbbec3d.com/develop/ then copied the OpenNI-Linux-Arm64-2.3.0.63 directory to my device and ran install.sh. Now when I plug in the camera I get:
[ 5887.390778] hub 1-1:1.0: 2 ports detected
[ 5887.879656] usb 1-1.1: New USB device found, idVendor=2bc5, idProduct=050b
[ 5887.886538] usb 1-1.1: New USB device strings: Mfr=2, Product=1, SerialNumber=3
[ 5887.894193] usb 1-1.1: Product: USB 2.0 Camera
[ 5887.898757] usb 1-1.1: Manufacturer: Sonix Technology Co., Ltd.
[ 5887.904814] usb 1-1.1: SerialNumber: SN0001
[ 5888.232284] usb 1-1.2: New USB device found, idVendor=2bc5, idProduct=060b
[ 5888.239161] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 5888.246856] usb 1-1.2: Product: ORBBEC Depth Sensor
[ 5888.251853] usb 1-1.2: Manufacturer: Orbbec(R)
I cross-compiled a simple app:
int main(int argc, char** argv)
{
const char* deviceURI = openni::ANY_DEVICE;
Status result = STATUS_OK;
result = OpenNI::initialize();
cout << "OpenNI::initialize() = " << result << endl;
openni::Array<openni::DeviceInfo> deviceList;
openni::OpenNI::enumerateDevices(&deviceList);
cout << "OpenNI::enumerateDevices() = " << deviceList.getSize() << endl;
for (int i = 0; i < deviceList.getSize(); ++i)
{
cout << "Device " << deviceList[i].getUri() << " already connected" << endl;
}
When I ran it first I got:
error while loading shared libraries: libOpenNI2.so: cannot open shared object file: No such file or director
So I copied libOpenNI2.so to /usr/lib. Now when I run it I get:
OpenNI::initialize() = 1
OpenNI::enumerateDevices() = 0
Why isn't the camera being seen? Is there something else I have to do to get it to work?
I turned on logging using:
OpenNI::setLogMinSeverity(0);
OpenNI::setLogConsoleOutput(true);
and saw:
3774 INFO Log XnLog.cpp 349 New log started on 2019-11-25 09:57:11
3864 INFO Log XnLog.cpp 322 --- Filter Info --- Minimum Severity: VERBOSE
4044 VERBOSE OniContext OniContext.cpp 165 OpenNI 2.3.0 (Build 63)-Linux-Arm (May 13 2019 17:45:57)
4089 VERBOSE OniContext OniContext.cpp 259 Using '/usr/lib/OpenNI2/Drivers' as driver path
4112 VERBOSE OniContext OniContext.cpp 267 Looking for drivers at '/usr/lib/OpenNI2/Drivers'
4167 ERROR OniContext OniContext.cpp 279 Found no drivers matching '/usr/lib/OpenNI2/Drivers/lib*.so'
So I copied the files from OpenNI-Linux-Arm64-2.3.0.63/Redist/OpenNI2/Drivers/ to /usr/lib/OpenNI2/Drivers/. The Readme also says:
*for using with Astra Embedded S/Stereo S, please change the resolution in 'orbbec.ini' to 'Resolution=17' for Depth and IR streams
So I edited this in /usr/lib/OpenNI2/Drivers/orbbec.ini. Now I get:
3924 INFO Log XnLog.cpp 349 New log started on 2019-11-25 10:23:55
4010 INFO Log XnLog.cpp 322 --- Filter Info --- Minimum Severity: VERBOSE
4185 VERBOSE OniContext OniContext.cpp 165 OpenNI 2.3.0 (Build 63)-Linux-Arm (May 13 2019 17:45:57)
4230 VERBOSE OniContext OniContext.cpp 259 Using '/usr/lib/OpenNI2/Drivers' as driver path
4254 VERBOSE OniContext OniContext.cpp 267 Looking for drivers at '/usr/lib/OpenNI2/Drivers'
4547 VERBOSE OniContext OniContext.cpp 309 Loading device driver 'libOniFile.so'...
4588 WARNING xnOS XnLinuxSharedLibs.cpp 107 loading lib from: /usr/lib/OpenNI2/Drivers/libOniFile.so
6199 VERBOSE OniContext OniContext.cpp 309 Loading device driver 'libPSLink.so'...
6240 WARNING xnOS XnLinuxSharedLibs.cpp 107 loading lib from: /usr/lib/OpenNI2/Drivers/libPSLink.so
11412 WARNING DriverHandler OniDriverHandler.cpp 85 LibraryHandler: Couldn't find function oniDriverStreamConvertC2DCoordinates in libPSLink.so. Stopping
11539 WARNING OniContext OniContext.cpp 313 Couldn't use file 'libPSLink.so' as a device driver
11626 VERBOSE OniContext OniContext.cpp 309 Loading device driver 'liborbbec.so'...
11675 WARNING xnOS XnLinuxSharedLibs.cpp 107 loading lib from: /usr/lib/OpenNI2/Drivers/liborbbec.so
15571 INFO Log XnLog.cpp 349 New log started on 2019-11-25 10:23:55
15615 INFO Log XnLog.cpp 322 --- Filter Info --- Minimum Severity: VERBOSE
15645 VERBOSE xnUSB XnLinuxUSB.cpp 383 Initializing USB...
19162 INFO xnUSB XnLinuxUSB.cpp 412 USB is initialized.
OpenNI::initialize() = 0
OpenNI::enumerateDevices() = 0
which is better but still not successful. I then realised that I hadn't reconnected the camera after copying the driver files so I did that and it worked.

New PocketSphinx user: "Segmentation fault: 11" error upon following official getting started guide

I am a new PocketSphinx user. I just followed the official getting started guide
However, I begin having difficulties when I get to this step:
"To test the installation, run pocketsphinx_continuous -inmic yes and check that it recognizes words you speak into your microphone."
I've attached my terminal output that I receive when I type this command, which ultimately results in 'Segmentation fault: 11'
Any help would be greatly appreciated.
Thanks,
Nakul
nakul : ~ 101 $ pocketsphinx_continuous -inmic yes
INFO: pocketsphinx.c(152): Parsed model-specific feature parameters from /usr/local/share/pocketsphinx/model/en-us/en-us/feat.params
Current configuration:
[NAME] [DEFLT] [VALUE]
-agc none none
-agcthresh 2.0 2.000000e+00
-allphone
-allphone_ci no no
-alpha 0.97 9.700000e-01
-ascale 20.0 2.000000e+01
-aw 1 1
-backtrace no no
-beam 1e-48 1.000000e-48
-bestpath yes yes
-bestpathlw 9.5 9.500000e+00
-ceplen 13 13
-cmn live batch
-cmninit 40,3,-1 41.00,-5.29,-0.12,5.09,2.48,-4.07,-1.37,-1.78,-5.08,-2.05,-6.45,-1.42,1.17
-compallsen no no
-debug 0
-dict /usr/local/share/pocketsphinx/model/en-us/cmudict-en-us.dict
-dictcase no no
-dither no no
-doublebw no no
-ds 1 1
-fdict
-feat 1s_c_d_dd 1s_c_d_dd
-featparams
-fillprob 1e-8 1.000000e-08
-frate 100 100
-fsg
-fsgusealtpron yes yes
-fsgusefiller yes yes
-fwdflat yes yes
-fwdflatbeam 1e-64 1.000000e-64
-fwdflatefwid 4 4
-fwdflatlw 8.5 8.500000e+00
-fwdflatsfwin 25 25
-fwdflatwbeam 7e-29 7.000000e-29
-fwdtree yes yes
-hmm /usr/local/share/pocketsphinx/model/en-us/en-us
-input_endian little little
-jsgf
-keyphrase
-kws
-kws_delay 10 10
-kws_plp 1e-1 1.000000e-01
-kws_threshold 1 1.000000e+00
-latsize 5000 5000
-lda
-ldadim 0 0
-lifter 0 22
-lm /usr/local/share/pocketsphinx/model/en-us/en-us.lm.bin
-lmctl
-lmname
-logbase 1.0001 1.000100e+00
-logfn
-logspec no no
-lowerf 133.33334 1.300000e+02
-lpbeam 1e-40 1.000000e-40
-lponlybeam 7e-29 7.000000e-29
-lw 6.5 6.500000e+00
-maxhmmpf 30000 30000
-maxwpf -1 -1
-mdef
-mean
-mfclogdir
-min_endfr 0 0
-mixw
-mixwfloor 0.0000001 1.000000e-07
-mllr
-mmap yes yes
-ncep 13 13
-nfft 512 512
-nfilt 40 25
-nwpen 1.0 1.000000e+00
-pbeam 1e-48 1.000000e-48
-pip 1.0 1.000000e+00
-pl_beam 1e-10 1.000000e-10
-pl_pbeam 1e-10 1.000000e-10
-pl_pip 1.0 1.000000e+00
-pl_weight 3.0 3.000000e+00
-pl_window 5 5
-rawlogdir
-remove_dc no no
-remove_noise yes yes
-remove_silence yes yes
-round_filters yes yes
-samprate 16000 1.600000e+04
-seed -1 -1
-sendump
-senlogdir
-senmgau
-silprob 0.005 5.000000e-03
-smoothspec no no
-svspec 0-12/13-25/26-38
-tmat
-tmatfloor 0.0001 1.000000e-04
-topn 4 4
-topn_beam 0 0
-toprule
-transform legacy dct
-unit_area yes yes
-upperf 6855.4976 6.800000e+03
-uw 1.0 1.000000e+00
-vad_postspeech 50 50
-vad_prespeech 20 20
-vad_startspeech 10 10
-vad_threshold 2.0 2.000000e+00
-var
-varfloor 0.0001 1.000000e-04
-varnorm no no
-verbose no no
-warp_params
-warp_type inverse_linear inverse_linear
-wbeam 7e-29 7.000000e-29
-wip 0.65 6.500000e-01
-wlen 0.025625 2.562500e-02
INFO: feat.c(715): Initializing feature stream to type: '1s_c_d_dd', ceplen=13, CMN='batch', VARNORM='no', AGC='none'
INFO: acmod.c(162): Using subvector specification 0-12/13-25/26-38
INFO: mdef.c(518): Reading model definition: /usr/local/share/pocketsphinx/model/en-us/en-us/mdef
INFO: mdef.c(531): Found byte-order mark BMDF, assuming this is a binary mdef file
INFO: bin_mdef.c(336): Reading binary model definition: /usr/local/share/pocketsphinx/model/en-us/en-us/mdef
INFO: bin_mdef.c(516): 42 CI-phone, 137053 CD-phone, 3 emitstate/phone, 126 CI-sen, 5126 Sen, 29324 Sen-Seq
INFO: tmat.c(149): Reading HMM transition probability matrices: /usr/local/share/pocketsphinx/model/en-us/en-us/transition_matrices
INFO: acmod.c(113): Attempting to use PTM computation module
INFO: ms_gauden.c(127): Reading mixture gaussian parameter: /usr/local/share/pocketsphinx/model/en-us/en-us/means
INFO: ms_gauden.c(242): 42 codebook, 3 feature, size:
INFO: ms_gauden.c(244): 128x13
INFO: ms_gauden.c(244): 128x13
INFO: ms_gauden.c(244): 128x13
INFO: ms_gauden.c(127): Reading mixture gaussian parameter: /usr/local/share/pocketsphinx/model/en-us/en-us/variances
INFO: ms_gauden.c(242): 42 codebook, 3 feature, size:
INFO: ms_gauden.c(244): 128x13
INFO: ms_gauden.c(244): 128x13
INFO: ms_gauden.c(244): 128x13
INFO: ms_gauden.c(304): 222 variance values floored
INFO: ptm_mgau.c(476): Loading senones from dump file /usr/local/share/pocketsphinx/model/en-us/en-us/sendump
INFO: ptm_mgau.c(500): BEGIN FILE FORMAT DESCRIPTION
INFO: ptm_mgau.c(563): Rows: 128, Columns: 5126
INFO: ptm_mgau.c(595): Using memory-mapped I/O for senones
INFO: ptm_mgau.c(838): Maximum top-N: 4
INFO: phone_loop_search.c(114): State beam -225 Phone exit beam -225 Insertion penalty 0
INFO: dict.c(320): Allocating 138824 * 32 bytes (4338 KiB) for word entries
INFO: dict.c(333): Reading main dictionary: /usr/local/share/pocketsphinx/model/en-us/cmudict-en-us.dict
INFO: dict.c(213): Dictionary size 134723, allocated 1016 KiB for strings, 1679 KiB for phones
INFO: dict.c(336): 134723 words read
INFO: dict.c(358): Reading filler dictionary: /usr/local/share/pocketsphinx/model/en-us/en-us/noisedict
INFO: dict.c(213): Dictionary size 134728, allocated 0 KiB for strings, 0 KiB for phones
INFO: dict.c(361): 5 words read
INFO: dict2pid.c(396): Building PID tables for dictionary
INFO: dict2pid.c(406): Allocating 42^3 * 2 bytes (144 KiB) for word-initial triphones
INFO: dict2pid.c(132): Allocated 42672 bytes (41 KiB) for word-final triphones
INFO: dict2pid.c(196): Allocated 42672 bytes (41 KiB) for single-phone word triphones
INFO: ngram_model_trie.c(354): Trying to read LM in trie binary format
INFO: ngram_search_fwdtree.c(74): Initializing search tree
INFO: ngram_search_fwdtree.c(101): 791 unique initial diphones
INFO: ngram_search_fwdtree.c(186): Creating search channels
INFO: ngram_search_fwdtree.c(323): Max nonroot chan increased to 152609
INFO: ngram_search_fwdtree.c(333): Created 723 root, 152481 non-root channels, 53 single-phone words
INFO: ngram_search_fwdflat.c(157): fwdflat: min_ef_width = 4, max_sf_win = 25
INFO: continuous.c(307): pocketsphinx_continuous COMPILED ON: Sep 6 2018, AT: 19:28:29
INFO: continuous.c(252): Ready....
Segmentation fault: 11
nakul : ~ 102 $ defaults write com.apple.finder AppleShowAllFiles YES.

UBIFS boot error

I have a SAM9 based board running embedded linux.
I had a JFFS2 file system and now thinking of moving to UBIFS.
I enabled UBIFS as target file system in make menuconfig of buildroot package which I'm using for my board.
I generated the rootfs.arm.ubifs file which I flashed on my board using nandwrite utility of bootloader the same way which I was using for .jffs2 file.
I also changed the bootargs to :
setenv bootargs 'console=ttyS0,115200 rw ubi.mtd=1,2048 rootfstype=ubifs root=ubi0:rootfs'
But I'm getting the following error which booting the board :
Creating 2 MTD partitions on "atmel_nand":
0x000000000000-0x000000400000 : "Kernel"
0x000000400000-0x000010000000 : "Data"
UBI: attaching mtd1 to ubi0
UBI: physical eraseblock size: 131072 bytes (128 KiB)
UBI: logical eraseblock size: 126976 bytes
UBI: smallest flash I/O unit: 2048
UBI: sub-page size: 512
UBI: VID header offset: 2048 (aligned 2048)
UBI: data offset: 4096
UBI warning: ubi_scan: 276 PEBs are corrupted
corrupted PEBs are: 0 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 517
UBI error: ubi_read_volume_table: the layout volume was not found
UBI error: ubi_init: cannot attach mtd1
UBI error: ubi_init: UBI error: cannot initialize UBI, error -22
This is a guess, but did you ubinize your rootfs before flashing it onto the raw NAND?
From http://www.linux-mtd.infradead.org/doc/ubifs.html#L_usptools
The images produced by mkfs.ubifs may be written to UBI volumes using
ubiupdatevol or may be further fed to the ubinize tool to create an UBI
image which may be put to the raw flash.

AMD APP (OpenCL) not working with CL_DEVICE_TYPE_GPU

I am experimenting with OpenCL programming. I was following the article in
http://www.thebigblob.com/getting-started-with-opencl-and-gpu-computing/
When the CPU is used ie CL_DEVICE_TYPE_DEFAULT it works fine.
Sample output:
...
1015 + 9 = 1024
1016 + 8 = 1024
1017 + 7 = 1024
1018 + 6 = 1024
1019 + 5 = 1024
1020 + 4 = 1024
1021 + 3 = 1024
1022 + 2 = 1024
1023 + 1 = 1024
...
However whenever I try to use the GPU (CL_DEVICE_TYPE_GPU) it doesn't work.
Sample output:
...
1015 + 9 = 0
1016 + 8 = 0
1017 + 7 = 0
1018 + 6 = 0
1019 + 5 = 0
1020 + 4 = 0
1021 + 3 = 0
1022 + 2 = 0
1023 + 1 = 0
...
I have install AMD APP SDK 2.6 on my system which is running on a Core 2 Duo E4500 and the GPU is a HIS Radeon HD 5450.
Cheers,
Utsav
If you installed AMD APP SDK 2.6 then go to C:\Users\%USER%\Documents\AMD APP\samples\opencl\cl\app
There you will find ton of samples you can change the code to make it use GPU such as Template C where you can change the code to point to GPU when creating context
context = clCreateContextFromType(cps,
CL_DEVICE_TYPE_GPU,
NULL,
NULL,
&status);
Some more checkpoint to make it work
1. Install the Latest AMD Catalayst Drivers from here : http://support.amd.com/us/gpudownload/Pages/index.aspx
Download GPU caps viewer and make sure your GPU devices are recognized.
http://downloads.guru3d.com/GPU-Caps-Viewer-1.7.0-download-1584.html
HTH

Resources