Re: kan man visa USB enhets namn på en extern manick?
Postat: 2 mars 2015, 19:00:20
Jag med.. Men det är inte tillräckligt nördigt för mig längre.. 

Svenskt forum för elektroniksnack.
https://elektronikforumet.com/forum/
Kod: Markera allt
/*
Name Offset(byte) Size(bytes)
BS_VolLab 71 11
*/
/*
####################################################################
This field has the same definition as it does for FAT12 and FAT16
media. The only difference for FAT32 media is that the field is at a
different offset in the boot sector.
#####################################################################
Volume label. This field matches the 11-byte volume label
recorded in the root directory.
NOTE: FAT file system drivers should make sure that they update
this field when the volume label file in the root directory has its
name changed or created. The setting for this field when there is no
volume label is the string “NO NAME ”
#####################################################################
*/
#include <stdio.h>
#include <fcntl.h>
#define start 71
#define end 11
int main(int argc, char* argv[]) {
char *buf[30];
FILE *disk=fopen(argv[1],"rb");
fseek(disk,start,SEEK_SET);
fread(buf,end,1,disk);
printf("%s\n",buf);
}
Kod: Markera allt
./a.out /dev/sdb1
NO NAME