*** Merbot has joined #sailfishos-porters | 17:07 | |
lbt | vgrade: http://www.merproject.org/logs/%23sailfishos-porters/ | 17:09 |
---|---|---|
lbt | Stskeeps: ^ | 17:09 |
tbr | let me de-uglify that | 17:16 |
*** Aquilum has quit IRC | 17:19 | |
tbr | done | 17:21 |
*** Aquilum has joined #sailfishos-porters | 17:24 | |
lbt | tbr: ty | 17:25 |
lbt | tbr: I added me as a bot owner too - just fyi | 17:25 |
tbr | sure | 17:26 |
lbt | https://github.com/leamas/supybot-git ? | 17:26 |
lbt | oh - wait | 17:26 |
lbt | that one is crap | 17:26 |
lbt | it clones repos and polls them :) | 17:26 |
lbt | nm ... -> tango o/ | 17:27 |
tbr | enjoy | 17:27 |
vgrade | lbt: tbr thanks | 18:04 |
netchip | MSameer: that doesn't work | 18:25 |
netchip | MSameer: because I have to pass a hardware_device_t to open() | 18:25 |
MSameer | netchip: cast it | 18:29 |
netchip | MSameer: doesn't work | 18:30 |
MSameer | what's the error? | 18:30 |
MSameer | and show me the code :) | 18:30 |
netchip | mer_camera.cpp:24:11: error: 'camera_device_t' has no member named 'close' :P | 18:30 |
netchip | easy fix | 18:30 |
MSameer | camera_device_t *dev; | 18:31 |
MSameer | dev->ops | 18:31 |
netchip | http://sprunge.us/UNVV | 18:32 |
netchip | derp thing | 18:32 |
MSameer | mmm | 18:32 |
MSameer | where is the close... | 18:32 |
MSameer | hw_device_t has it | 18:33 |
netchip | meh, fixed it, I hope | 18:33 |
MSameer | dev->common.close() | 18:33 |
netchip | hw_get_module worries me | 18:33 |
netchip | because it assumes it | 18:33 |
netchip | it gets a hw_device_t | 18:34 |
netchip | and a hw_device_t doesn't inherit camera_device_t | 18:34 |
netchip | inversed, I mean | 18:34 |
MSameer | bbl child | 18:34 |
netchip | sure | 18:34 |
situ | sledges: around ? | 18:40 |
MSameer | netchip: don't be worried as long as it works | 18:49 |
MSameer | netchip: the other explanation is: you are casting a subclass (camera_device_t) to a superclass (hw_device_t) which should work | 18:49 |
sledges | situ: yepish | 19:04 |
situ | sledges: So what do we need to check ? | 19:05 |
sledges | restore debugfs systemd files, reboot; systemctl --user stop lipstick.service, strace -fF `the pid of the systemd --user` -- and past the output for us after executing `systemctl --user start lipstick.service` in another window | 19:06 |
sledges | situ: ^ | 19:06 |
netchip | MSameer: get_parameters works | 19:07 |
netchip | do we have logging, btw?? | 19:07 |
netchip | I don't want to log to stdout | 19:07 |
MSameer | you can log to stderr | 19:07 |
MSameer | and redirect it to a file | 19:07 |
MSameer | ./test 2> foo.log | 19:08 |
MSameer | or even to /dev/null | 19:08 |
netchip | MSameer: How do I do that with cout? :P And I heard sledges talk anout journalctl? | 19:08 |
MSameer | netchip: std::cerr :) | 19:08 |
MSameer | netchip: I don't know how to log to journalctl | 19:08 |
netchip | Oh OK | 19:08 |
netchip | I want something like Android's ALOGV | 19:09 |
netchip | and ALOGI | 19:09 |
netchip | works perfectly | 19:09 |
MSameer | viewing logs via logcat is easier than stdout?! | 19:10 |
MSameer | #include <syslog.h> | 19:10 |
netchip | MSameer: I don't want my stdout to be cluttered with things like "called put_parameters" :P | 19:11 |
MSameer | netchip: are you on linux? | 19:11 |
netchip | yes | 19:11 |
MSameer | man syslog | 19:11 |
situ | sledges: Good site for long pastes ? | 19:12 |
netchip | MSameer: where does that output to? | 19:13 |
MSameer | situ: pastebin.com is not enough? | 19:13 |
situ | http://pastebin.com/mCwKistY | 19:13 |
MSameer | netchip: to syslog and I think that goes to journalctl | 19:13 |
netchip | :D | 19:13 |
situ | MSameer: I have seen problems with pastebin some time back. | 19:13 |
MSameer | netchip: but I really don't know | 19:13 |
netchip | The option argument to openlog() is an OR of any of these what's an OR? | 19:14 |
MSameer | netchip: one or more separated with | | 19:15 |
netchip | oh it's a binary thingy? | 19:15 |
MSameer | yup :) | 19:16 |
netchip | I've always wanted to know how exactly that works | 19:16 |
netchip | I can count in the binary system | 19:16 |
netchip | but no clue how the binary operators work | 19:16 |
MSameer | netchip: easy | 19:16 |
MSameer | 001 | 010 gives you 011 | 19:17 |
MSameer | 001 & 011 gives 001 | 19:17 |
MSameer | ^ <- I always forget that | 19:17 |
netchip | how does the program interpret that? | 19:17 |
MSameer | it tests the various bits | 19:18 |
MSameer | so: | 19:18 |
MSameer | if (011 & 001) { print("001 is set") } | 19:18 |
MSameer | I think that's the basic thing | 19:18 |
netchip | & is the thing in common | 19:18 |
netchip | | is the thing added together (basically)? | 19:19 |
MSameer | netchip: it's the binary AND operator | 19:19 |
MSameer | | is the OR operator | 19:19 |
MSameer | & is the AND | 19:19 |
MSameer | netchip: http://en.wikipedia.org/wiki/Bitwise_operations_in_C | 19:20 |
situ | sledges: Still around ? | 19:20 |
*** slate has quit IRC | 19:20 | |
netchip | MSameer: I'll read it in a bit :) | 19:21 |
MSameer | netchip: I think now I started to understand ^ operator | 19:21 |
MSameer | netchip: thanks for pointing me indirectly to that article :) | 19:21 |
* MSameer learned something new \o/ :D | 19:21 | |
netchip | :D | 19:21 |
netchip | next week I have two projectdays @ school about sustainable energy | 19:23 |
netchip | it's interesting | 19:23 |
MSameer | what are you studying ? | 19:23 |
MSameer | (if I may ask) | 19:23 |
netchip | Hehe, middleschool (European equivalent of highschool), 15 years old | 19:24 |
netchip | 3rd form, going to the 4th form | 19:24 |
netchip | (of the 6th forms) | 19:24 |
MSameer | I know you are 15 years old :) | 19:24 |
netchip | of the six forms* | 19:24 |
MSameer | bu I thought that a project would be at collage so I was confused | 19:25 |
* MSameer slaps himself | 19:25 | |
situ | I feel like I should have started programming much earrlier. | 19:25 |
netchip | we have a lot of projects | 19:25 |
MSameer | netchip: +1 :) | 19:25 |
netchip | situ: So do I, lol. But hey, I didn't understand it years ago. | 19:25 |
netchip | Maths education helped :) | 19:25 |
MSameer | you need discreet math | 19:26 |
situ | netchip: You should read this book when you get time http://mindview.net/Books/TICPP/ThinkingInCPP2e.html | 19:26 |
MSameer | or that's what I heard :P | 19:26 |
MSameer | when I was 15, I think I didn't have a computer of my own | 19:27 |
MSameer | netchip: and grab a copy of the C++ programming language | 19:27 |
netchip | I have The C Programming language here | 19:28 |
netchip | but despite of the good reviews, I find it to be a poor book | 19:28 |
MSameer | netchip: that's is fine. don't read it if you don't like it | 19:28 |
netchip | well | 19:28 |
MSameer | I don't remember I have ever read a book fully | 19:28 |
netchip | it's too simple | 19:28 |
netchip | too superficial | 19:28 |
situ | netchip: What do you think is missing from that book ? | 19:28 |
MSameer | netchip: I hope you don't feel offended but based on working with you for ~2 days, your C/C++ knowledge is superficial too | 19:29 |
netchip | MSameer: I know it is ;) | 19:29 |
netchip | and I don't feel offended | 19:29 |
netchip | situ: it explains every bit of C, yes. But it misses good examples | 19:29 |
MSameer | netchip: so we need to find you a good book or set of tutorials to get you started (assuming it's what you want) | 19:29 |
MSameer | netchip: bypass the bad chapters | 19:30 |
MSameer | examples? you are seeing them now :D | 19:30 |
MSameer | netchip: then try thinking in C++ | 19:30 |
*** slate has joined #sailfishos-porters | 19:30 | |
MSameer | something I liked was diving into python. it starts with an example but it's python | 19:31 |
netchip | I learned Java mostly by doing :) I think C++ is less of a learn-by-doing-language | 19:31 |
netchip | and I think I'll download thinking in C++ if it's available as epub | 19:32 |
netchip | those books are often expensive | 19:32 |
situ | netchip: It's available in ebook form. | 19:32 |
netchip | I don't see it on a very popular torrent site :p I mean, 75EUR for two books is much money | 19:33 |
netchip | thinking in problems: how mathematics find creative solutions, looks interesting | 19:34 |
situ | netchip: http://www.datastore.cz/bruceeckel/ | 19:35 |
situ | The links to download were there on that page itself. | 19:35 |
netchip | yeh | 19:39 |
netchip | I see | 19:39 |
MSameer | netchip: you learn programming really by doing | 19:39 |
MSameer | one of the reasons why my java is very rusty is I never had to use it for anything | 19:39 |
MSameer | netchip: but for C++, you need some concepts and you are good to go | 19:39 |
MSameer | pointers are also *(&(&*^&*%&* | 19:39 |
MSameer | netchip: wouldn't using cameraservce directly make your life easier wrt camera? | 19:40 |
netchip | I don't know :) But I like this approach :P I think I learn more doing it this way, but if you think using cameraservice is better for me to learn C++, sure. I'll do the cameraservice way then. | 19:41 |
MSameer | i have to admit that I don't know :) | 19:42 |
MSameer | perhaps a good way is to get an idea of all chapters then map the practical part we are doing now to the relevant chapter of the book? | 19:43 |
netchip | the syntax of C++ isn't my problem; the problem is more: when can I cast this to that, what are the restrictions of pointers, what are smartpointers etc | 19:43 |
MSameer | aha | 19:44 |
MSameer | casting in our context is simple | 19:44 |
MSameer | a class A that inherits another class B | 19:45 |
MSameer | B is the parent class or superclass | 19:45 |
MSameer | A is subclass | 19:45 |
MSameer | and in general, you can cast a subclass to a super class (or a parent class) | 19:45 |
MSameer | but C++ has more casting details | 19:46 |
netchip | I don't see how camera_device_t inherits hw_device_t. Sure, the name implies it. However, I don't see it code-wise | 19:46 |
MSameer | because this is C | 19:47 |
MSameer | the first member of camera_device_t is hw_device_t common; | 19:47 |
netchip | yes | 19:47 |
netchip | why do we cast camera_device_t to hw_device_t, then? | 19:48 |
netchip | it only contains a structure called hw_device_t | 19:48 |
MSameer | http://stackoverflow.com/questions/1114349/struct-inheritance-in-c | 19:48 |
MSameer | netchip: it contains more | 19:48 |
MSameer | camera_device_ops_t *ops; | 19:48 |
netchip | yeah | 19:48 |
MSameer | void *priv; | 19:48 |
MSameer | netchip: i have an idea for you: go to codeaurora and check the forst qualcomm camera hal | 19:49 |
netchip | MSameer: I did :) That's how I fixed the open() problem | 19:49 |
MSameer | let me try to find a good example for you | 19:50 |
netchip | the derivation of structures in C is ... illogical | 19:50 |
netchip | or unlogical or whatever | 19:51 |
netchip | I associate inheritance with OOP | 19:51 |
MSameer | https://www.codeaurora.org/cgit/quic/la/platform/hardware/qcom/camera/tree/QCamera/HAL/wrapper/QualcommCamera.cpp#n63 | 19:53 |
MSameer | netchip: it's confusing because it's not logical and I agree :) | 19:53 |
netchip | how comes the : is possible? | 19:54 |
MSameer | but I think it works because it has something to do with how it's stored in memory | 19:54 |
MSameer | where? | 19:54 |
netchip | L64 | 19:54 |
MSameer | it assigns | 19:55 |
MSameer | gcc extension IIRC | 19:55 |
MSameer | line 74 is the struct you get via hw_get_module | 19:55 |
MSameer | so it is camera_module_t | 19:55 |
MSameer | and this is why you need to pass camera_module_t * and not hw_module_t | 19:55 |
* MSameer food | 19:55 | |
MSameer | netchip: here is what gets assigned to your pointer: https://www.codeaurora.org/cgit/quic/la/platform/hardware/qcom/camera/tree/QCamera/HAL/wrapper/QualcommCamera.cpp#n241 | 20:37 |
netchip | MSameer: oh, so a camera_device is casted to a hw_device | 20:39 |
MSameer | it's the address of common which is the first member | 20:43 |
MSameer | netchip: here is an example: http://pastebin.com/1xcpQCdL | 20:47 |
MSameer | netchip: it prints the address of the struct and the address of the first element | 20:47 |
MSameer | and note they are the same | 20:48 |
MSameer | bar = 0x8644008, foo = 0x8644008 | 20:48 |
MSameer | so we can do: Bar *b2 = (Bar *)f; | 20:49 |
MSameer | and it will still work | 20:49 |
netchip | hmm yeah | 21:02 |
netchip | it's complicated | 21:02 |
MSameer | no it's not | 21:10 |
MSameer | netchip: you see it a the programmer sees it | 21:11 |
MSameer | netchip: but when the app gets executed and the struct start to be assigned to a memory address then it's just bytes following bytes | 21:11 |
netchip | MSameer: well, it makes sense | 21:11 |
MSameer | there is no such thing as a struct inside a struct in RAM because RAM does not know | 21:11 |
MSameer | those 4 bytes are reserved for the int and then another 4 for the next int | 21:12 |
MSameer | whether it's inside another struct or not does not make a difference | 21:12 |
MSameer | netchip: do you know that the address to an array of chars is the address of the first element? | 21:12 |
netchip | yes | 21:12 |
MSameer | this is the same :) | 21:13 |
netchip | question: Foo *f = &b->foo; | 21:13 |
netchip | why &b? | 21:13 |
MSameer | because we need an address | 21:13 |
netchip | that's the adress of the pointer right? | 21:13 |
MSameer | Foo *f is a pointer | 21:13 |
MSameer | b->foo is the element itself | 21:13 |
MSameer | and the element is of a type Foo | 21:13 |
netchip | ah | 21:13 |
netchip | yes | 21:13 |
MSameer | pointers are confusing | 21:14 |
netchip | I see it now | 21:14 |
MSameer | so if we have: | 21:14 |
MSameer | struct Foo { int bar; char zot; } | 21:15 |
MSameer | and if address of Foo is 0x4 for example | 21:15 |
MSameer | then 0x4 is also the address of bar | 21:16 |
MSameer | and 0x8 is the address of zot | 21:16 |
MSameer | assuming int is 4 bytes long (32 bit integer) | 21:16 |
MSameer | but don't just add offsets to the struct like that because it will blow up in real world :) | 21:17 |
netchip | ahhh | 21:28 |
netchip | and that's how it's possible to cast it... | 21:28 |
*** hexo has joined #sailfishos-porters | 21:28 | |
MSameer | :) | 21:31 |
netchip | it became clearer | 21:31 |
netchip | it's still blackmagic, but it's enoguh to use it :) | 21:31 |
MSameer | well, then you need to start asking more concrete questions | 21:32 |
MSameer | I don't know how to explain it farther :/ | 21:32 |
netchip | MSameer: don't feel bad about it | 21:35 |
netchip | the blackmagic thing is | 21:35 |
netchip | MSameer: http://pastebin.com/ZjZ6cAyZ how would three and four get filled if barvariable = (foo) foovariable | 21:39 |
MSameer | they don't | 21:41 |
MSameer | they are garbage | 21:41 |
MSameer | but in our case, camera_device_t gets casted to hw_device_t | 21:41 |
MSameer | actually, if you doo: | 21:41 |
MSameer | foo *f = malloc(sizeof(foo)); | 21:42 |
MSameer | and then did bar *b = (bar *) f; | 21:42 |
MSameer | then if you try to write to b->three; then you will crash | 21:42 |
MSameer | because that memory does not belong to you | 21:42 |
MSameer | you might crash | 21:43 |
netchip | MSameer: how would ops be useful then | 21:49 |
netchip | (member of camera_device_t_ | 21:49 |
netchip | because we give the pointer to mDevice (type: camera_device_t) the value of the pointer to hw_device_t | 21:50 |
netchip | i'm off to sleep | 21:55 |
MSameer | what camera hal allocates is camera_device_t | 21:55 |
MSameer | ok | 21:55 |
MSameer | good night :) | 21:55 |
netchip | hmm? | 21:55 |
netchip | it allocates hw_device_t, right? | 21:55 |
MSameer | hal allocates camera_device_t | 21:55 |
MSameer | and it gives it to us disguised as hw_device_t | 21:55 |
netchip | ah | 21:56 |
netchip | that was the part I didn't understand | 21:56 |
netchip | got it :) | 21:56 |
netchip | anyways, gnight! | 21:56 |
MSameer | night :) | 21:56 |
*** hexo has quit IRC | 22:24 | |
*** hexo has joined #sailfishos-porters | 22:25 | |
*** hexo has quit IRC | 22:27 | |
*** hexo has joined #sailfishos-porters | 22:28 | |
sledges | situ: ping | 23:24 |
Generated by irclog2html.py 2.17.1 by Marius Gedminas - find it at https://mg.pov.lt/irclog2html/!