[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

/dev-kodestil, gentoo, udev, raw1394



Hej

Jeg kører Gentoo og dermed udev. Når jeg sætter mit kamera i
ieee1394-stikket og loader raw1394, så får jeg en /dev/raw/raw1394
- og ikke andet.

Når jeg så kører dvgrab, så kalder den libraw1394, der så igen prøver at
åbne /dev/raw1394.

dvgrab skriver så: File not found.
Øhm ja? Hvilken file er not found?
(strace er min ven)

Koden i libraw1394, main.c, raw1394_new_handle(void)
ser sådan ud:
        handle->fd = open("/dev/raw1394", O_RDWR);
        if (handle->fd < 0) {
             free(handle);
             return NULL;
        }

Er det pæn kodestil?
Kan man regne med at der findes en /dev/raw1394?

Ville det ikke have været mere rimeligt med en
raw1394_new_handle(char *try_this_dev_name)
og så prøve den først, og så evt. /dev/raw1394
efterfølgende. Om ikke andet, så kunne man give en returkode der sagde:
THE_DEVICE_NAME_YOU_GAVE_IS_NOT_FOUND og dvgrab ville så vide hvilket
navn der rent faktisk var tale om og skrive det på skærmen.

Om ikke andet, har jeg lavet min egen kode om til:
        handle->fd = open("/dev/raw1394", O_RDWR);
        if (handle->fd < 0) {
                handle->fd = open("/dev/raw/raw1394", O_RDWR);
                if (handle->fd < 0) {
                        free(handle);
                        return NULL;
                }
        }
ikke særligt meget pænere, men det virker....

Burde det ikke være sådan at et lib åbnede den device man bad om, fx
firewire port nr. 2, og der derfor skulle et filnavn med i det kald?

/hans




 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-11-01, 02:01 CET [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *