Giter VIP home page Giter VIP logo

camlib's People

Contributors

etra0 avatar petabyt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

camlib's Issues

Fix string enums

Might have interference in enum dump table. For example "ExpCompensation" is canon, and "Mode" is Fujifilm. Probably will switch to having vendors in the string.

Cannot build on Linux or Windows

Hi @petabyt @etra0 !

When I try to build I receive following error:

$ make
cc -c -I/usr/include/libusb-1.0 -lusb-1.0 -Isrc/ -I../mjs/ -DVERBOSE -Wall -g src/operations.c -o src/operations.o
cc -c -I/usr/include/libusb-1.0 -lusb-1.0 -Isrc/ -I../mjs/ -DVERBOSE -Wall -g src/packet.c -o src/packet.o
cc -c -I/usr/include/libusb-1.0 -lusb-1.0 -Isrc/ -I../mjs/ -DVERBOSE -Wall -g src/enums.c -o src/enums.o
cc -c -I/usr/include/libusb-1.0 -lusb-1.0 -Isrc/ -I../mjs/ -DVERBOSE -Wall -g src/data.c -o src/data.o
cd src && python3 stringify.py
Compiled 340 enums
cc -c src/enum_dump.c -I/usr/include/libusb-1.0 -lusb-1.0 -Isrc/ -I../mjs/ -DVERBOSE -Wall -g -o src/enum_dump.o
cc -c -I/usr/include/libusb-1.0 -lusb-1.0 -Isrc/ -I../mjs/ -DVERBOSE -Wall -g src/util.c -o src/util.o
cc -c -I/usr/include/libusb-1.0 -lusb-1.0 -Isrc/ -I../mjs/ -DVERBOSE -Wall -g src/canon.c -o src/canon.o
cc -c -I/usr/include/libusb-1.0 -lusb-1.0 -Isrc/ -I../mjs/ -DVERBOSE -Wall -g src/liveview.c -o src/liveview.o
cc -c -I/usr/include/libusb-1.0 -lusb-1.0 -Isrc/ -I../mjs/ -DVERBOSE -Wall -g src/bind.c -o src/bind.o
cc -c -I/usr/include/libusb-1.0 -lusb-1.0 -Isrc/ -I../mjs/ -DVERBOSE -Wall -g src/libusb.c -o src/libusb.o
src/libusb.c: In function ‘ptp_device_init’:
src/libusb.c:83:43: error: ‘LIBUSB_ENDPOINT_TRANSFER_TYPE_BULK’ undeclared (first use in this function); did you mean ‘LIBUSB_TRANSFER_TYPE_BULK’?
83 | if (ep[i].bmAttributes == LIBUSB_ENDPOINT_TRANSFER_TYPE_BULK) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| LIBUSB_TRANSFER_TYPE_BULK
src/libusb.c:83:43: note: each undeclared identifier is reported only once for each function it appears in
src/libusb.c:91:50: error: ‘LIBUSB_ENDPOINT_TRANSFER_TYPE_INTERRUPT’ undeclared (first use in this function); did you mean ‘LIBUSB_TRANSFER_TYPE_INTERRUPT’?
91 | } else if (ep[i].bmAttributes == LIBUSB_ENDPOINT_TRANSFER_TYPE_INTERRUPT) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| LIBUSB_TRANSFER_TYPE_INTERRUPT
make: *** [Makefile:28: src/libusb.o] Error 1

Any tips?

BR,

Ladislav

Segfault on "bind_run"

Hi!

@petabyt

I am trying the following code:

#include <stdio.h>
#include <camlib.h>

int main(int argc, char** argv) {
    struct PtpRuntime ptp;
    ptp_generic_init(&ptp);

    char buffer[PTP_BIND_DEFAULT_SIZE];
    int r = bind_run(&ptp, "ptp_init", buffer, sizeof(buffer));
    printf("ptp_init: %s\n", buffer);

    r = bind_run(&ptp, "ptp_connect", buffer, sizeof(buffer));
    printf("ptp_connect: %s\n", buffer);

    r = bind_run(&ptp, "ptp_open_session", buffer, sizeof(buffer));
    printf("ptp_open_session: %s\n", buffer);

    r = bind_run(&ptp, "ptp_get_device_info", buffer, sizeof(buffer));
    printf("ptp_get_device_info: %s\n", buffer);

    r = bind_run(&ptp, "ptp_close_session", buffer, sizeof(buffer));
    printf("ptp_close_session: %s\n", buffer);

    r = bind_run(&ptp, "ptp_disconnect", buffer, sizeof(buffer));
    printf("ptp_disconnect: %s\n", buffer);

    ptp_generic_close(&ptp);
}

Which unfortunately ends up with segmentation fault on ptp_get_device_info:

ptp_init: {"error": 0, "buffer": 8000000}
Initializing USB...
Vendor ID: 4A9, Product ID: 32B4
Endpoint IN addr: 0x81
Endpoint OUT addr: 0x2
Endpoint INT addr: 0x83
ptp_connect: {"error": 0}
send_bulk_packets 0x1002 (PTP_OC_OpenSession)
send_bulk_packet: Sent 16 bytes
recieve_bulk_packets: Read 12 bytes
recieve_bulk_packets: Return code: 0x2001
ptp_open_session: {"error": 0}
Segmentation fault

Any idea, where is the problem? Did I maybe miss something?

BR,

Ladislav

I spelled receive wrong

I wrote "recieve" in around 100 different places in this codebase, I apologize
If you were feel useless, know that I won the spelling bee 3 times and still can't spell 2nd grade words

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.