petabyt / camlib Goto Github PK
View Code? Open in Web Editor NEWPicture Transfer Protocol library
Home Page: https://danielc.dev/camlib/
License: Apache License 2.0
Picture Transfer Protocol library
Home Page: https://danielc.dev/camlib/
License: Apache License 2.0
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.
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
Hi!
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 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
The link to the documentation in your readme.md is broken.
Right now it goes to...
https://danielc.dev/camlib-docs/
Poking around a bit on your site, I think maybe it's supposed to go to...
https://danielc.dev/camlib/
And also, python bindings would be great for people like me who suck at computers :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.